风云小站|Connecting Lives With Infinite New Discoveries » 非常AD区 » Bit-HDTV: More friendly options for scripts

Bit-HDTV: More friendly options for scripts

空白 管理员
楼主 2022-03-17 06:22
私信 引用 编辑

Bit-HDTV: More friendly options for scripts

Bit-HDTV: More friendly options for scripts

Quote:

This announcement is more for the tech savy users / developers.

As we know a while back we have an API from where you can search torrents and get response in a standardized format. (https://api.bit-hdtv.com/docs)

We extended these with some easy options to search / upload and download torrents using the api key without totally exposing your account (using cookies or user/pass).

The following 3 actions can be done by api key (without cookies or user/pass) and response in standard format for scripts/scrapers/automations projects can handle easy.

1. Search torrents using the API (already available)

2. Upload torrent
- upload.php
- output response in json/xml/html
- auth just with api key

example request:

curl linux

Copy code
curl --location -g
--request POST 'https://www.bit-hdtv.com/takeupload.php' \
--form 'file=@"A.Discovery.of.Witches.S03E07.720p.WEB.H264-GGEZ.torrent"'\
--form 'nfo=@"nfo.nfo"' \
--form 'format="json"' \
--form 'name="A.Discovery.of.Witches.S03E07.720p.WEB.H264-GGEZ"' \
--form 'descr="test descr"' \
--form 'sdescr=""' \
--form 'cat="10"' \
--form 'subcat="8"' \
--form 'resolution="1"' \
--form 'url="https://www.tvmaze.com/shows/31339/a-discovery-of-witches"'\
--form 'screen="test screens"' \
--form 'mediainfo="test mediainfo"' \
--form 'api_key="{{apiKey}}"'


python
Copy code
import requests
url = "https://www.bit-hdtv.com/takeupload.php"

payload={
'format': 'json',
'name': 'A.Discovery.of.Witches.S03E07.720p.WEB.H264-GGEZ',
'descr': 'test descr',
'sdescr': '',
'cat': '10',
'subcat': '8',
'resolution': '1',
'url': 'https://www.tvmaze.com/shows/31339/a-discovery-of-witches',
'screen': 'test screens',
'mediainfo': 'test mediainfo',
'api_key': ''}

files=[
('file',('A.Discovery.of.Witches.S03E07.720p.WEB.H264-GGEZ.torrent',
open('A.Discovery.of.Witches.S03E07.720p.WEB.H264-GGEZ.torrent','rb'),
'application/octet-stream')),
('nfo',('nfo.nfo',open('nfo.nfo','rb'),'application/octet-stream'))


Make sure to set  api_key and format !

Response


Copy code
http code 200

Success

{
   "status": "Success",
   "data": {
       "id": 431273,
       "view": "https://www.bit-hdtv.com/details.php?id=431273
&uploaded=1",
       "download": "https://www.bit-hdtv.com/rssdownload.php?id=431273&
api_key={{apiKey}}"
   }
}

Error

{
   "status": "Error",
   "message": "Upload failed!",
   "data": "This torrent is already uploaded!"
}


3. Download torrent
- rssdownload.php using just the api key

https://www.bit-hdtv.com/rssdownload.php?id=<the id>&api_key=<the api key>

example


Copy code
https://www.bit-hdtv.com/rssdownload.php?id=431273&api_key={{apiKey}}


How to generate an API KEY ?




Go to Profile in the top left and at the bottom of the page you will see an option to add an Api Key.
Input password and Submit.