Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error on HDT #310

Open
FuNFooKaS opened this issue Jan 31, 2024 · 34 comments
Open

error on HDT #310

FuNFooKaS opened this issue Jan 31, 2024 · 34 comments

Comments

@FuNFooKaS
Copy link
Contributor

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
Copy link

skifavp commented Feb 2, 2024

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
Copy link

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
Copy link
Contributor

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
Copy link

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
Copy link
Contributor

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
Copy link
Contributor

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

@AN1MATEK
Copy link

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
Copy link

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

@sirius-sama
Copy link
Contributor

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
Copy link

skifavp commented Feb 14, 2024

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
Copy link
Contributor

sirius-sama commented Feb 14, 2024

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

@skifavp
Copy link

skifavp commented Feb 15, 2024

Update: the .org domain working

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

@sirius-sama
Copy link
Contributor

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
Copy link

skifavp commented Feb 15, 2024

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
Copy link
Contributor

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
Copy link

PunchDrunkL0ve commented Feb 17, 2024

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
Copy link
Contributor

@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
Copy link

@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#issuecomment-1949887168] In both cases the filenames are in 'standard' format and have nothing unusual 🤷🏻‍♂️

@sirius-sama
Copy link
Contributor

@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#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
Copy link

@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
Copy link
Contributor

@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
Copy link

PunchDrunkL0ve commented Feb 18, 2024

@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
Copy link
Contributor

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
Copy link

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
Copy link
Contributor

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 ✌️

@XaXo81
Copy link

XaXo81 commented Feb 26, 2024

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
Copy link
Contributor

sirius-sama commented Feb 26, 2024

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 ✌️

@PunchDrunkL0ve
Copy link

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
Copy link
Contributor

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
Copy link

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
Copy link
Contributor

@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
Copy link

@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
Copy link
Contributor

@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
Copy link

@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.

Audionut added a commit to Audionut/Upload-Assistant that referenced this issue Oct 5, 2024
Fixes from L4GSP1KE#310 (comment)

Requires manual cookie management, see instructions in the linked issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants