Get the number of readers of a treatise on Mendeley in Python

Introduction

Researchers may be concerned about the number of citations of academic papers they have seen / written. You can easily check the number of citations on Google scholar etc. As a precursor to the number of citations, there is also the number of readers in the literature management software Mendeley. At least this doesn't seem to be known without opening Mendeley. So, after practicing scraping, I created a script to get the number of Mendeley readers.

Referenced articles

[1] Web scraping with python [2] List of precautions for web scraping

environment

Windows Python 3

script

The full text is below. The explanation continues below.

a.py


# Modules
import requests

# Constants
Mendeley = 'https://www.mendeley.com/catalogue/'
PaperID = []
PaperID.append("5a856ac7-0d75-3560-8824-9f9061f3eb50/")

# Functions
def SandwitchedText(text_source,text_1, text_2):
    return text_source.split(text_1)[1].split(text_2)[0]


for a in PaperID:
    r = requests.get(Mendeley + a)
    text = r.text

    print("Title : " + SandwitchedText(text, "\"title\":\"", "\",\"detail"))
    print("readers : " + SandwitchedText(text, "readers:", ":"))
    print("citations : " + SandwitchedText(text, "citations:", ":"))

--requests is a package that can be used for scraping [1]. Pay attention to the scraping rules when using [2]. --Give the corresponding URL as the information of the treatise for which you want to obtain data. This article is based on the famous High Temperature Superconductivity Paper. The part of the variable Mendeley in the script is fixed, and the part of the URL that differs for each treatise is given to the list of PaperIDs. --As SandwitchedText, we define a function that returns the part between the given string text_source and text_1 and text_2. --You can get the source of the page corresponding to the URL with requests.get (url) .text. In the script, the source is stored as a string in the text. --Finally, get the title of the treatise, the number of mendeley readers, and the number of citations from the page source and output it to the console. Now, stare at the source of the page to find where you need the information in the source and use the SandwitchedText function to get the information.

At the end

If you increase the number of papers in the list, you can get information on several papers at once. I think it's a little smarter if you give it a title instead of the URL of the treatise.

Recommended Posts

Get the number of readers of a treatise on Mendeley in Python
Get the number of specific elements in a python list
Get the caller of a function in Python
How to get the number of digits in Python
Get the size (number of elements) of UnionFind in Python
Output the number of CPU cores in Python
[Python] Get the files in a folder with Python
Make a copy of the list in Python
Find the number of days in a month
Output in the form of a python array
Get a capture of the entire web page in Selenium Python VBA
Get the number of searches with a regular expression. SeleniumBasic VBA Python
Check the in-memory bytes of a floating point number float in Python
Get a datetime instance at any time of the day in Python
Check if the string is a number in python
[Python] A program that counts the number of valleys
[python] Get the list of classes defined in the module
Get the number of digits
[Python] Get the number of views of all posted articles
Get the URL of the HTTP redirect destination in Python
A reminder about the implementation of recommendations in Python
How to get a list of files in the same directory with python
[Example of Python improvement] I learned the basics of Python on a free site in 2 weeks.
Get the value of a specific key in a list from the dictionary type in the list with Python
[Python] A program that finds the shortest number of steps in a game that crosses clouds
A note on the default behavior of collate_fn in PyTorch
Find out the apparent width of a string in python
Analyzing data on the number of corona patients in Japan
[Note] Import of a file in the parent directory in Python
[Homology] Count the number of holes in data with Python
How to get the last (last) value in a list in Python
How to get a list of built-in exceptions in python
Get the number of occurrences for each element in the list
Find the eigenvalues of a real symmetric matrix in Python
Get the index of each element of the confusion matrix in Python
Get the desktop path in Python
Get the script path in Python
Get the number of Youtube subscribers
Get the desktop path in Python
Get the host name in Python
Get the value of a specific key up to the specified index in the dictionary list in Python
[OCI] Python script to get the IP address of a compute instance in Cloud Shell
[Python] Programming to find the number of a in a character string that repeats a specified number of times.
I tried to create a Python script to get the value of a cell in Microsoft Excel
How is the progress? Let's get on with the boom ?? in Python
Count the number of Thai and Arabic characters well in Python
How to determine the existence of a selenium element in Python
Try to get a list of breaking news threads in Python.
[Python] Let's reduce the number of elements in the result in set operations
Read the standard output of a subprocess line by line in Python
How to check the memory size of a dictionary in Python
[Python] Get the update date of a news article from HTML
A function that measures the processing time of a method in python
[python] Get the rank of the values in List in ascending / descending order
Find the rank of a matrix in the XOR world (rank of a matrix on F2)
Create a function to get the contents of the database in Go
Get the formula in an excel file as a string in Python
Get a list of files in a folder with python without a path
Get the title and delivery date of Yahoo! News in Python
Write the test in a python docstring
Display a list of alphabets in Python 3