Also add "file size" in -j option #1485

Closed
opened 2026-02-20 23:29:58 -05:00 by deekerman · 2 comments
Owner

Originally created by @xubuntu4iran on GitHub (Dec 9, 2013).

youtube-dl --proxy "" -j http://www.aparat.com/v/teYF2
WARNING: Falling back on generic information extractor.
{"extractor": "generic", "format": "0 - unknown", "uploader": "www.aparat.com", "format_id": "0", "id": "cc8ea41f89ccbcdcec29ead4965101d6859928", "stitle": "\u062d\u0644\u0642\u0647 \u0647\u0648\u0634\u0645\u0646\u062f \u0628\u0631\u0627\u06cc \u06a9\u0646\u062a\u0631\u0644 \u062a\u0644\u0641\u0646", "playlist": null, "title": "\u062d\u0644\u0642\u0647 \u0647\u0648\u0634\u0645\u0646\u062f \u0628\u0631\u0627\u06cc \u06a9\u0646\u062a\u0631\u0644 \u062a\u0644\u0641\u0646", "url": "http://host11.aparat.com//public/user_data/flv_video_new/287/cc8ea41f89ccbcdcec29ead4965101d6859928.apt", "extractor_key": "Generic", "playlist_index": null, "ext": "apt", "webpage_url": "http://www.aparat.com/v/teYF2", "fulltitle": "\u062d\u0644\u0642\u0647 \u0647\u0648\u0634\u0645\u0646\u062f \u0628\u0631\u0627\u06cc \u06a9\u0646\u062a\u0631\u0644 \u062a\u0644\u0641\u0646"}
Originally created by @xubuntu4iran on GitHub (Dec 9, 2013). <pre> youtube-dl --proxy "" -j http://www.aparat.com/v/teYF2 WARNING: Falling back on generic information extractor. {"extractor": "generic", "format": "0 - unknown", "uploader": "www.aparat.com", "format_id": "0", "id": "cc8ea41f89ccbcdcec29ead4965101d6859928", "stitle": "\u062d\u0644\u0642\u0647 \u0647\u0648\u0634\u0645\u0646\u062f \u0628\u0631\u0627\u06cc \u06a9\u0646\u062a\u0631\u0644 \u062a\u0644\u0641\u0646", "playlist": null, "title": "\u062d\u0644\u0642\u0647 \u0647\u0648\u0634\u0645\u0646\u062f \u0628\u0631\u0627\u06cc \u06a9\u0646\u062a\u0631\u0644 \u062a\u0644\u0641\u0646", "url": "http://host11.aparat.com//public/user_data/flv_video_new/287/cc8ea41f89ccbcdcec29ead4965101d6859928.apt", "extractor_key": "Generic", "playlist_index": null, "ext": "apt", "webpage_url": "http://www.aparat.com/v/teYF2", "fulltitle": "\u062d\u0644\u0642\u0647 \u0647\u0648\u0634\u0645\u0646\u062f \u0628\u0631\u0627\u06cc \u06a9\u0646\u062a\u0631\u0644 \u062a\u0644\u0641\u0646"} </pre>
Author
Owner

@phihag commented on GitHub (Dec 9, 2013):

filesize will be present in the output when provided by the extractor:

$ youtube-dl http://fast.wistia.net/embed/iframe/sh7fpupwlt -j | jq .formats[].filesize
11981466
12255921
19524818
19565116
38287449
38391271
432792422

However, as detailed in #190 and probably a dozen other issues, it is not possible to always determine the filesize in advance, and complicated and slow (we have to send an extra request) to to determine it even if the download is via HTTP, and the server supports HEAD requests, and it sends a Content-Length header.

Since I don't need to determine file sizes in advance and it's more a ballpark figure anyways (For example, YouTube is always switching around files, so when we actually go download the file, it size may have changed already), I'm not interested in developing this option myself. Feel free to pose a pull request that offers that though (just make sure to test it at least that it doesn't mess with - at least - RTMP, HTTPS, broken HTTP servers that invalidate content after the first request, HTTP servers that don't support HEAD as per spec (i.e. return 501 or 415), HTTP servers that return HEAD requests without Content-Type, or with an incorrect one.

@phihag commented on GitHub (Dec 9, 2013): `filesize` will be present in the output when provided by the extractor: ``` $ youtube-dl http://fast.wistia.net/embed/iframe/sh7fpupwlt -j | jq .formats[].filesize 11981466 12255921 19524818 19565116 38287449 38391271 432792422 ``` However, as detailed in #190 and probably a dozen other issues, it is not possible to always determine the filesize in advance, and complicated and slow (we have to send an extra request) to to determine it even if the download is via HTTP, and the server supports HEAD requests, and it sends a `Content-Length` header. Since I don't need to determine file sizes in advance and it's more a ballpark figure anyways (For example, YouTube is always switching around files, so when we actually go download the file, it size may have changed already), I'm not interested in developing this option myself. Feel free to pose a pull request that offers that though (just make sure to test it at least that it doesn't mess with - at least - RTMP, HTTPS, broken HTTP servers that invalidate content after the first request, HTTP servers that don't support HEAD as per spec (i.e. return 501 or 415), HTTP servers that return HEAD requests without `Content-Type`, or with an incorrect one.
Author
Owner

@xubuntu4iran commented on GitHub (Dec 9, 2013):

I'm sorry for repeating issue, thank you for description.

@xubuntu4iran commented on GitHub (Dec 9, 2013): I'm sorry for repeating issue, thank you for description.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#1485
No description provided.