def addlist_mal(item):
data = httptools.downloadpage(item.url).data
anime_id = scrapertools.find_single_match(data, 'id="myinfo_anime_id" value="([^"]+)"')
if item.value == "2":
vistos = scrapertools.find_single_match(data, 'id="myinfo_watchedeps".*?<span id="curEps">(\d+)')
else:
vistos = scrapertools.find_single_match(data, 'id="myinfo_watchedeps".*?value="(\d+)"')
if not item.score:
item.score = scrapertools.find_single_match(data, 'id="myinfo_score".*?selected" value="(\d+)"')
token = scrapertools.find_single_match(data, "name='csrf_token' content='([^']+)'")
post = {'anime_id': int(anime_id), 'status': int(item.value), 'score': int(item.score), 'num_watched_episodes': int(vistos), 'csrf_token': token}
headers_mal = {'User-Agent': 'Mozilla/5.0', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Referer': item.url, 'X-Requested-With': 'XMLHttpRequest'}
url = "https://myanimelist.net/ownlist/anime/add.json"
if item.lista:
url = "https://myanimelist.net/ownlist/anime/edit.json"
data = httptools.downloadpage(url, post=jsontools.dump_json(post), headers=headers_mal, replace_headers=True).data
item.title = "En tu lista"
if config.is_xbmc():
import xbmc
xbmc.executebuiltin("Container.Refresh")
评论列表
文章目录