For Nyaa:
- Get your torrent number
For example, https://nyaa.si/view/1002779 -> number is 1002779
- - Your feed URL is https://nyaacomments.tk/1002779
+ - Your feed URL is https://adrianiainlam.tk/nyaacomments/1002779
For Sukebei.nyaa:
Prepend 's' before the number
- For example, https://nyaacomments.tk/s1002779
+ For example, https://adrianiainlam.tk/nyaacomments/s1002779
Bug reports welcome at <spam@adrianiainlam.tk> (replace "spam" with "me"),
or on <https://github.com/adrianiainlam/nyaa-comments-rss-generator>.
else:
sukebei = False
+
+ #self.send_response(503)
+ #self.send_header('Content-type', 'text/plain')
+ #self.end_headers()
+ #self.wfile.write(bytes('503 Service Temporarily Unavailable: Nyaa has blacklisted me :(', 'utf-8'))
+ #return
+
try:
if self.path[1] == 's':
sukebei = True
url = "https://sukebei.nyaa.si/view/" + str(nyaaid)
else:
url = "https://nyaa.si/view/" + str(nyaaid)
- useragent = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0"
+ useragent = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0"
req = requests.get(url, headers={"user-agent": useragent})
self.send_response(req.status_code)
htmltitle = parser.getElementsByTagName('title')[0].innerHTML
fg.title('Comments for ' + htmltitle)
fg.id(url)
- fg.link(href='https://nyaacomments.tk' + self.path, rel='self')
+ fg.link(href='https://adrianiainlam.tk/nyaacomments' + self.path, rel='self')
i = 1
timestamp = None
if __name__ == '__main__':
- server = HTTPServer(('localhost', 2800), NyaaComments)
+ server = HTTPServer(('localhost', 2799), NyaaComments)
server.serve_forever()