விக்கிமூலம்:பைத்தான்3நிரல்கள்/API/பகுப்புப் பக்கங்களை எடுத்தல்
Appearance
#!/usr/bin/python3
"""
get_category_items.py
'max' denotes only 500 pages
MediaWiki API Demos https://www.mediawiki.org/wiki/API:Categorymembers
Demo of `Categorymembers` module : List twenty items in a category"cmcontinue":"Dirac membrane",
MIT License
https://en.wikipedia.org/wiki/Category:Articles_with_%27species%27_microformats
my effort : https://www.mediawiki.org/wiki/API_talk:Categorymembers#What_is_the_value_for_PARAM:%22cmcontinue%22:
"""
import requests
S = requests.Session()
URL = "https://ta.wikisource.org/w/api.php"
PARAMS = {
"action": "query",
"cmtitle": "Category:1000 எண்ணுன்மிகள் பக்க அளவிட்ட அட்டவணைகள்",
"cmlimit": "max",
# "cmcontinue":'page|292b292d314f514d044d3941393f3f3941514d011701dc16|40181405',
"list": "categorymembers",
"format": "json"
}
R = S.get(url=URL, params=PARAMS)
DATA = R.json()
print(DATA)
PAGES = DATA['query']['categorymembers']
#print(PAGES)
count = 0
for page in PAGES:
count = count + 1
pageTitle=page['title']
if not "Category:" in pageTitle:
print(str(count) + '. ' + pageTitle)