Muss das ganze über die xREL via API (oAuth2) gemacht werden? Wenn es auch ohne geht, hier ein kleines python script
PHP-Code:# -*- coding: utf-8 -*-
import urllib2
import sys
import re
from bs4 import BeautifulSoup
"""
xrel oeffnen, nach Release suchen und nfo laden als Bild (Url) und als Text
Syntax: xrel.py "Releasename"
Getestet unter: Python 2.7.13 (Windows)
"""
xrel_url = "https://www.xrel.to/search.html?mode=full&xrel_search_query=" + sys.argv[1]
req = urllib2.Request(xrel_url)
req.add_header('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8')
req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36')
req.add_header('Referer', 'https://www.xrel.to/releases.html')
req.add_header('Cookie', 'notice_understood=1')
resp = urllib2.urlopen(req)
content = resp.read()
soup = BeautifulSoup(content, "html.parser")
nfo_bild_url = soup.find('img', src=re.compile('nfo-render.html'))
nfo_bild_url = "https://www.xrel.to" + nfo_bild_url['src']
print nfo_bild_url #nfo als Bild (Url)
print "\n"
nfo_text = soup.find("div", {"id": "nfo_text"}).text
print nfo_text #nfo als Text




Zitieren