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

doesn't work after 3-July-2023 since Twitter is using new API now. #26

Open
656229093 opened this issue Jul 3, 2023 · 8 comments
Open
Labels
bug Something isn't working partially-fixed

Comments

@656229093
Copy link

doesn't work after 3-July-2023 since Twitter is using new API now.

@honbit
Copy link

honbit commented Jul 3, 2023

The original API has been deleted, The new API is to obtain 20 pieces of information in batches.
I don’t have the ability to update this. I look forward to your update. Thank you

@AlttiRi
Copy link
Owner

AlttiRi commented Jul 3, 2023

Oh, fuck, the video downloading do not work.

https://twitter.com/i/api/2/timeline/conversation/${tweetId}.json?tweet_mode=extended

returns 404 now

{"errors":[{"message":"Sorry, that page does not exist","code":34}]}

@AlttiRi AlttiRi added the bug Something isn't working label Jul 3, 2023
@AlttiRi AlttiRi pinned this issue Jul 3, 2023
@AlttiRi AlttiRi unpinned this issue Jul 3, 2023
@honbit
Copy link

honbit commented Jul 3, 2023

Twitter delete individual media files API,
You can get information in bulk through this interface(return a huge JSON).
eg: "/i/api/graphql/Az0-KW6F-FyYTc2OJmvUhg/UserMedia"

I don’t know if this message is useful to you.
Look forward to your good news.

@AlttiRi
Copy link
Owner

AlttiRi commented Jul 3, 2023

Yeah, I curently figure out how to parse the data from https://twitter.com/i/api/graphql/${API.queryId}/TweetDetail?....

For example, mp4 url for a tweet with a single video:

data.threaded_conversation_with_injections_v2.instructions[0].entries[0]
    .content.itemContent.tweet_results.result.legacy
    .extended_entities.media
    ...

Also, ideally, it would require to automatically get queryId (Az0-KW6F-FyYTc2OJmvUhg from your example) from https://abs.twimg.com/responsive-web/client-web-legacy/api.7d71e8ca.js file.

Since it can expire.


BTW, here is the updated versions of them:
https://github.com/fa0311/TwitterInternalAPIDocument/blob/master/docs/json/API.json


@mikf changes them once per some months:
https://github.com/search?q=repo:mikf/gallery-dl+twitter+update+query+hashes&type=commits

AlttiRi added a commit that referenced this issue Jul 3, 2023
@AlttiRi
Copy link
Owner

AlttiRi commented Jul 3, 2023

42b3daa

const instruction = json.data.threaded_conversation_with_injections_v2.instructions.find(ins => ins.type === "TimelineAddEntries"); 
const tweetObject = instruction.entries.find(ins => ins.entryId === "tweet-" + tweetId) 
const tweetData = tweetObject.content.itemContent.tweet_results.result.legacy; 

Possibly, fixed, but I need to test it with different tweet types. I only tested it with a tweet with one video.

For example, I need to fix it again: #7


OK, the main bug is fixed, I will continue a bit later.

@AlttiRi AlttiRi pinned this issue Jul 3, 2023
@honbit
Copy link

honbit commented Jul 3, 2023

Great!

@biggestsonicfan
Copy link

Possibly related tweet, gif (video) isn't downloading.

@AlttiRi
Copy link
Owner

AlttiRi commented Jul 6, 2023

Possibly related tweet, gif (video) isn't downloading.

image

It's "Embedded video". I see it first time.* Seems it's possible to get the URL even without using API, just from HTML.

Currently, I made the simple fix with using API: c66f6cf. However, it's better do not use API at all if it's possible.

@AlttiRi AlttiRi unpinned this issue Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working partially-fixed
Projects
None yet
Development

No branches or pull requests

4 participants