ScratchTrend retrieves popular works from https://scratch.mit.edu/explore.
(This library is not affiliated with the Scratch Foundation.)
(日本語版はここからどうぞ。)
Terminal
$ pip install scratchtrend
Import
import scratchtrend as sct
from scratchtrend.select import Lang, Sort
Required Libraries and Apps
- Chrome Browser
- Selenium
- BeautifulSoup
Recommended Libraries
- chromedriver_binary
- webdriver_manager
If one of the above is installed, it will automatically ChromeDriver path through.
sct.CHROMEDRIVER_PATH = "chromedriver path"
If one of the recommended libraries is not included, you can specify it here. (If they are installed, this will be ignored.)
# example
data = sct.connect(Lang.JAPANESE, Sort.POPULAR)
The list of languages that can be specified is in Languages.md.
Specify language and sorting by connect()
method.
Sort by:
Choose | Sort |
---|---|
Sort.TRENDING | Trending |
Sort.POPULAR | Popular |
Sort.RECENT | Recent |
(Still in the process of development, so there are few.)
data.get_by_page() # Get by specifying a page
data.get_by_rank() # Get by specifying a rank
The get_by_page()
method gets the works of the page from the start argument to the end argument.Be sure to use start<end.
The get_by_rank()
method retrieves the works of rank from the start argument to the end argument.Be sure to use start<end.
Return value
# Formatted for ease of viewing.
[
{
'title': 'project title',
'id': "project id"
},
{
'title': 'title',
'id': "ID"
}
]
Thus, it is returned in the dictionary in the list.
ScratchTrend is MIT licensed.
- Logo generated by DesignEvo free logo designer
- Selenium
- BeautifulSoup
- Translation was done using DeepL.