L4GSP1KE / Upload-Assistant

301 stars 93 forks source link

error on HDT #310

Open FuNFooKaS opened 5 months ago

FuNFooKaS commented 5 months ago
Uploading to HDT
Traceback (most recent call last):
  File "upload.py", line 524, in <module>
    asyncio.run(do_the_thing(base_dir))
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "upload.py", line 261, in do_the_thing
    if await tracker_class.validate_credentials(meta) == True:
  File "/home/user/Upload-Assistant/src/trackers/HDT.py", line 246, in validate_credentials
    await self.login(cookiefile)
  File "/home/user/Upload-Assistant/src/trackers/HDT.py", line 283, in login
    csrfToken = await self.get_csrfToken(session, url)
  File "/home/user/Upload-Assistant/src/trackers/HDT.py", line 319, in get_csrfToken
    csrfToken = soup.find('input', {'name' : 'csrfToken'}).get('value')
AttributeError: 'NoneType' object has no attribute 'get'

any idea why this is happening?

skifavp commented 5 months ago

I believe it started happening after they hard recent downtime of site. Now almost every time you enter it, it goes through DDOS cloud protection.

AN1MATEK commented 4 months ago

Yes, I think it has to do with DOS protection too. Maybe there is a way to quick fix it using FlareResolverr? Prowlarr gets through without a problem.

sirius-sama commented 4 months ago

I believe it started happening after they hard recent downtime of site. Now almost every time you enter it, it goes through DDOS cloud protection.

Exactly!

So, here is a quick fix - HDT.py Download this new HDT.py file and keep this in src/trackers/ directory. You can remove or keep the old HDT.py somewhere else.

From now on, we've to export cookies manually from the site and keep that in the data/cookies/ directory. You can use these cookie export extensions [Firefox, Chrome] to grab cookies.txt, rename the file to HDT.txt, and place it in the cookie directory.

That should work, no script login anymore. If cookies get expire then export a new one and you'll be good to go ;)

AN1MATEK commented 4 months ago

I have to see how I do this with in docker. I have a vague idea but have to see if it works. Maybe you can make a PR to push this change?

Thank you!

sirius-sama commented 4 months ago

I have to see how I do this with in docker. I have a vague idea but have to see if it works. Maybe you can make a PR to push this change?

I can make a PR, with no issues. But I don't think my PR will be merged to the main branch anytime soon, cuz L4G is busy irl. Also, I don't have any idea about docker.

sirius-sama commented 4 months ago

PR added. Hope you will find a way to make it work in Docker.

AN1MATEK commented 4 months ago

Thank you for your work. I tried to add it to docker by mapping the files with -v but unfortunately didn't work. I don't mind it not working for now, I have limited bandwidth and I have no need to upload to HDT at the moment.

So, when and if it gets merged is good enough for me :)

AN1MATEK commented 4 months ago

Oh it is already merged. Great, didn't noticed at first!

sirius-sama commented 4 months ago

Bad news. It's not working again. Pushing cookies is not doing the trick. I tried many times yesterday and every time it worked. But today, even after pushing new cookies, the site throws that captcha and Cloudflare loading page.

skifavp commented 4 months ago

I was ready to post that i have spent past hour trying to make it work with no success. Turns out i am not the only one.

sirius-sama commented 4 months ago

Update: the .org domain working Edit: My mistake, .net is working, I had issues with .org

skifavp commented 4 months ago

Update: the .org domain working

You got a cookie from hd-torrents.org website you mean or changed something in HDT.py?

sirius-sama commented 4 months ago

Update: the .org domain working

You got a cookie from hd-torrents.org website you mean or changed something in HDT.py?

I had issues with .org, I changed cookies and script URLs to .net now it's working. Sorry, I mistakenly mentioned .org instead of .net

skifavp commented 4 months ago

Update: the .org domain working

You got a cookie from hd-torrents.org website you mean or changed something in HDT.py?

I had issues with .org, I changed cookies and script URLs to .net now it's working. Sorry, I mistakenly mentioned .org instead of .net

It working now. However upon injecting in qbt it says torrent not authorized and have to recheck manually.

sirius-sama commented 4 months ago

Update: the .org domain working

You got a cookie from hd-torrents.org website you mean or changed something in HDT.py?

I had issues with .org, I changed cookies and script URLs to .net now it's working. Sorry, I mistakenly mentioned .org instead of .net

It working now. However upon injecting in qbt it says torrent not authorized and have to recheck manually.

Yeah, same here. Haven't checked for the solution yet.

PunchDrunkL0ve commented 4 months ago

Hi,

Using .net seems to accept the cookie but then there is a warning and an error:

HDT.py:108: SyntaxWarning: invalid escape sequence '-' hdt_name = re.sub("[^0-9a-zA-ZΓ€-ΓΏ. &+'-[]]+", "", hdt_name)

and

Traceback (most recent call last): File "C:\Upload-Assistant-master\upload.py", line 569, in asyncio.run(do_the_thing(base_dir)) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.752.0_x64\Lib\asyncio\runners.py", line 194, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.752.0_x64\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.752.0_x64\Lib\asyncio\base_events.py", line 685, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "upload.py", line 300, in do_the_thing await tracker_class.upload(meta) File "HDT.py", line 195, in upload search = re.search(r"download.php\?id\=([a-z0-9]+)", up.text).group(1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'group'

Any suggestions?

Many thanks.

sirius-sama commented 4 months ago

@skifavp Found the Issue. The source_flag was wrong. Whatever the domain is, the source_flag will always be the .org domain

@PunchDrunkL0ve I recently tried, and everything is okay. By looking at the error logs, it seems like you probably had a problem with the file name. Have you tried with other files?

PunchDrunkL0ve commented 4 months ago

@PunchDrunkL0ve I recently tried, and everything is okay. By looking at the error logs, it seems like you probably had a problem with the file name. Have you tried with other files?

Hi @sirius-sama

Thanks for your suggestion. Tried again with a different file but got the exact same error as above [https://github.com/L4GSP1KE/Upload-Assistant/issues/310#issuecomment-1949887168] In both cases the filenames are in 'standard' format and have nothing unusual πŸ€·πŸ»β€β™‚οΈ

sirius-sama commented 4 months ago

@PunchDrunkL0ve I recently tried, and everything is okay. By looking at the error logs, it seems like you probably had a problem with the file name. Have you tried with other files?

Hi @sirius-sama

Thanks for your suggestion. Tried again with a different file but got the exact same error as above [https://github.com/[/issues/310](https://github.com/L4GSP1KE/Upload-Assistant/issues/310)#issuecomment-1949887168] In both cases the filenames are in 'standard' format and have nothing unusual πŸ€·πŸ»β€β™‚οΈ

Well... this is very strange. I am attaching a updated HDT.py. Please try to use this one. Also remove your __pycache__ folder from your src/trackers/

PunchDrunkL0ve commented 4 months ago

@sirius-sama I really appreciate your effort but removing the pycache folder and trying again with the HDT.py from a few days ago and with your amended HDT.py still gives me the exact same error 🀯

sirius-sama commented 4 months ago

@sirius-sama I really appreciate your effort but removing the pycache folder and trying again with the HDT.py from a few days ago and with your amended HDT.py still gives me the exact same error 🀯

Damnn, why didn't I check the error log more carefully? Argghh! It's your Python version, there are a few problems with the newest version. I am using the old versions like 3.10. There's already a new issue created regarding the new Python version. #290

PunchDrunkL0ve commented 4 months ago

@sirius-sama I really appreciate your effort but removing the pycache folder and trying again with the HDT.py from a few days ago and with your amended HDT.py still gives me the exact same error 🀯

Damnn, why didn't I check the error log more carefully? Argghh! It's your Python version, there are a few problems with the newest version. I am using the old versions like 3.10. There's already a new issue created regarding the new Python version. #290

Good catch, although PTP.py works great πŸ€”

Just noticed that the [HDT].torrent file in /tmp does not have my announce url but a fake.tracker url and the .net source. Could that be the root of my issue? Thanks.

sirius-sama commented 4 months ago

Good catch, although PTP.py works great πŸ€”

I won't be able to track down the proper error unless I use the new version of python. I will try to do that soon.

Just noticed that the [HDT].torrent file in /tmp does not have my announce url but a fake.tracker url and the .net source. Could that be the root of my issue? Thanks.

If now you're using the old version of python and my updated script, then this shouldn't be the case, also your personal announce URL will be added after a successful upload.

(I checked again before writing this comment, everything works fine with the old version of python)

PunchDrunkL0ve commented 4 months ago

I won't be able to track down the proper error unless I use the new version of python. I will try to do that soon.

That would be amazing, many thanks.

sirius-sama commented 4 months ago

Here's an update: The .net domain is not working either.

And about that warning on the script start, that's just a regex error, we can ignore that error and things will work fine. After a few runs, I noticed that this error comes up once in a while. Of course, there is a fix but the main problem is that HDT is not working with both their .org and .net domains. The site not accepting cookies from the script.

IDK what would be the proper solution for this atm. A few things/solutions popped into my mind but I have to try them first. We'll see.

I think someone has to talk to the mods about it, or I'll do it :confused:

Sorry for the late update, been busy in the past few days. Hope, things will start working fine like before. Peace :v:

XaXo81 commented 4 months ago

Here's an update: The .net domain is not working either.

And about that warning on the script start, that's just a regex error, we can ignore that error and things will work fine. After a few runs, I noticed that this error comes up once in a while. Of course, there is a fix but the main problem is that HDT is not working with both their .org and .net domains. The site not accepting cookies from the script.

IDK what would be the proper solution for this atm. A few things/solutions popped into my mind but I have to try them first. We'll see.

I think someone has to talk to the mods about it, or I'll do it πŸ˜•

Sorry for the late update, been busy in the past few days. Hope, things will start working fine like before. Peace ✌️

Write in the helpdesk or pm byzon so we can help out.

sirius-sama commented 4 months ago

Good news! All domains should be working now. I only tested the .org and .net domains and both are working fine. A huge thanks to Byzon for helping me <3

If you face this login issue again, you can open a support ticket or PM Byzon on-site. He'll help you out.

Peace :v:

PunchDrunkL0ve commented 4 months ago

That's great news, many thanks to all involved, much appreciated.

Perhaps now it's worth looking at getting HDT.py to work with python 3.12?

sirius-sama commented 4 months ago

That's great news, many thanks to all involved, much appreciated.

Perhaps now it's worth looking at getting HDT.py to work with python 3.12?

Working on it. Trying to make the whole script v3.12 friendly.

tclyg2008 commented 2 months ago

Has anyone met this problem? failed for both PTER and HDT Uploading to HDT Traceback (most recent call last): File "C:\Users\SunnyGG\Upload-Assistant\upload.py", line 569, in <module> asyncio.run(do_the_thing(base_dir)) File "C:\Users\SunnyGG\AppData\Local\Programs\Python\Python38\lib\asyncio\runners.py", line 43, in run return loop.run_until_complete(main) File "C:\Users\SunnyGG\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete return future.result() File "C:\Users\SunnyGG\Upload-Assistant\upload.py", line 295, in do_the_thing if await tracker_class.validate_credentials(meta) == True: File "C:\Users\SunnyGG\Upload-Assistant\src\trackers\HDT.py", line 245, in validate_credentials vcookie = await self.validate_cookies(meta, cookiefile) File "C:\Users\SunnyGG\Upload-Assistant\src\trackers\HDT.py", line 258, in validate_cookies session.cookies.update(await common.parseCookieFile(cookiefile)) File "C:\Users\SunnyGG\Upload-Assistant\src\trackers\COMMON.py", line 185, in parseCookieFile cookies[lineFields[5]] = lineFields[6] IndexError: list index out of range

sirius-sama commented 2 months ago

@tclyg2008 It's strange, I've never had any issue with parsing HDT cookies, the error indicates there aren't enough lines in the cookie file.

A couple of questions for you:

  1. Is it the first time you're using this script for HDT and PTER? If not, then when it last worked for HDT and PTER?
  2. What browser extension you're using to export cookies? Try any of these: [Firefox, Chrome]
tclyg2008 commented 2 months ago

@sirius-sama Thank you for your quick response. I use the scripts on PC with windows 10.

  1. I never succeed on HDT and PTER meanwhile BLU BHD works fine.
  2. I use edge browser so I didn't use your mentioned extension, I also found one could export .txt cookie in edge. Maybe I will try your recommendation.
  3. I have a question that is in data\cookies\READ.MD; it says it will generate cookie automatically. But nothing there. The automation to grab cookies doesn't work, right? Thank you.
sirius-sama commented 2 months ago

@tclyg2008 Sorry for the late response. Did you try with other extensions to export cookies?

BLU and BHD have API to do all the stuff, so there is no need to use cookies for them. As for auto-generating cookie files in cookies folder is a thing for sites that accept standard login.

You could auto-generate cookies for HDT a few months back, but now they have Cloudflare protection, so we're using manually exported cookies to log in.

Anyways, I think you should try other extensions to grab cookies and see if it works.

tclyg2008 commented 2 months ago

@sirius-sama Thank you for your kind help. I've succeed on HDT when I changed to your recommended extension. There is no issue with the cookies. But the PTER still has other problem "KeyError: ptgen". I am trying to figure out the reason. Thank you for solving the cookie issue.