Commit Graph

230 Commits (42b098dd79e91295376ca98f394876555481a3eb)

Author SHA1 Message Date
Andrei Lebedev 27ed77aabb
[utils] Backport traverse_obj (etc) from yt-dlp (#31156)
* Backport traverse_obj and closely related function from yt-dlp (code by pukkandan)
* Backport LazyList, variadic(), try_call (code by pukkandan)
* Recast using yt-dlp's newer traverse_obj() implementation and tests (code by grub4k)
* Add tests for Unicode case folding support matching Py3.5+ (requires f102e3d)
* Improve/add tests for variadic, try_call, join_nonempty

Co-authored-by: dirkf <fieldhouse@gmx.net>
2 years ago
dirkf d231b56717
[jsinterp] Overhaul JSInterp to handle new YT players 4c3f79c5, 324f67b9 (#31170)
* back-port from yt-dlp 8f53dc44a0cc1c2d98c35740b9293462c080f5d0, thanks pukkandan
* also support void, improve <</>> precedence, improve expressions in comma-list
* add more tests
2 years ago
Remita Amine e88c9ef62a [utils] add a function to clean podcast URLs 4 years ago
Remita Amine 9dd674e1d2 [utils] accept only supported protocols in url_or_none 4 years ago
Sergey M․ fe07e788bf
[utils] Skip ! prefixed code in js_to_json 4 years ago
Kevin O'Connor 4eda10499e
[utils] Don't attempt to coerce JS strings to numbers in js_to_json (#26851)
The current logic in `js_to_json` tries to rewrite octal/hex numbers to
decimal. However, when the logic actually happens the `"` or `'` have
already been trimmed off. This causes what were originally strings, that
happen to look like octal/hex numbers, to get rewritten to decimal and
returned as a number rather than a string.

In practive something like:

```js
{
  "0x40": "foo",
  "040": "bar",
}
```

would get rewritten as:

```json
{
  64: "foo",
  32: "bar
}
```

This is problematic since this isn't valid JSON as you cannot have
non-string keys.
4 years ago
Sergey M․ 1d9bf655e6
[utils] Recognize wav mimetype (closes #26463) 4 years ago
Sergey M․ 42db58ec73
[utils] Improve str_to_int 5 years ago
Remita Amine 348c6bf1c1 [utils] handle int values passed to str_to_int 5 years ago
Sergey M․ 1ced222120
[utils] Add generic caesar cipher and rot47 5 years ago
InfernalUnderling 9d30c2132a [utils] Handle rd-suffixed day parts in unified_strdate (#23199) 5 years ago
Sergey M․ 824fa51165
[utils] Improve subtitles_filename (closes #22753) 5 years ago
Sergey M․ 28cc2241e4
[utils] Restrict parse_codecs and add theora as known vcodec (#21381) 5 years ago
Sergey M․ 53cd37bac5
[utils] Improve strip_or_none 6 years ago
Jakub Wilk fd35d8cdfd [utils] Transliterate "þ" as "th" (#20897)
Despite visual similarity "þ" is unrelated to "p".
It is normally transliterated as "th":

    $ echo þ-Þ | iconv -t ASCII//TRANSLIT
    th-TH
6 years ago
Sergey M․ 5e1271c56d
[utils] Improve int_or_none and float_or_none (#20403) 6 years ago
Sergey M․ 0dc41787af
[utils] Introduce parse_bitrate 6 years ago
Sergey M․ fad4ceb534
[utils] Fix urljoin for paths with non-http(s) schemes 6 years ago
Sergey M․ 25d110be30
[utils] Properly recognize AV1 codec (closes #17506) 6 years ago
Sergey M․ af03000ad5
[utils] Introduce url_or_none 6 years ago
Sergey M․ e9c671d5e8
[utils] Allow JSONP with empty func name (closes #17028) 6 years ago
Enes 85750f8972 [openload] Improve ext extraction 7 years ago
Remita Amine 3bb3ff38a1 [test_utils] add tests for b836118724 7 years ago
Sergey M․ 6cc622327f
[utils] Introduce merge_dicts 7 years ago
Sergey M․ 1cc47c6674
[utils] Fix match_str for boolean meta fields 7 years ago
Philipp Hagemeister f226880c6d [tennistv] Add support for tennistv.com 7 years ago
Sergey M․ b871d7e954
[utils] Add parse_resolution 7 years ago
Sergey M․ befa4708fd
[utils] Fixup some common URL's typos in sanitize_url (closes #15649) 7 years ago
Sergey M․ c707b1d828
[test_utils] Add tests for malformed JSON handling in js_to_json 7 years ago
Mike Fährmann c384d537f8 [util] Improve scientific notation handling in js_to_json (closes #14789) 7 years ago
Sergey M․ b555ae9bf1
[utils] Add another date format pattern (#14999) 7 years ago
Sergey M․ 056653bbb1
[utils] Add support for zero years and months in parse_duration 7 years ago
Yen Chi Hsuan 3869028ffb [utils] Use bytes-like objects in dfxp2srt
This fixes handling of non-UTF8 TTML subtitles

Closes #14191
7 years ago
Yen Chi Hsuan 95f3f7c20a
[utils] Fix unescapeHTML for misformed string like "&a&quot;" (#13935) 7 years ago
Sergey M․ 5b232f46dc
[utils] Skip missing params in cli_bool_option (closes #13865) 7 years ago
Sergey M․ dee2ff1d81
[test_utils] Fix tests under Windows 7 years ago
Yen Chi Hsuan 609ff8ca19 [utils] Support attributes with no values in get_elements_by_attribute() 7 years ago
Sergey M․ b4a3d461e4
[utils] Handle HTMLParseError in extract_attributes (closes #13349) 8 years ago
Sergey M․ 2ae2ffda5e
[utils] Improve unified_timestamp 8 years ago
Yen Chi Hsuan 5552c9eb0f
[utils] Recognize more patterns in strip_jsonp()
Used in Youku Show pages
8 years ago
Yen Chi Hsuan 0c26548601
[cda] Implement birthday verification (closes #12789) 8 years ago
Sergey M․ deef31955b
[utils] Improve unified_timestamp
Seen at http://zaq1.pl/video/xev0e
8 years ago
Tithen-Firion 9222d94510 [test_utils] Add one more clean_html test 8 years ago
Remita Amine 5b995f713b [utils] add support for ttml styles 8 years ago
Sergey M․ a426ef6d78
[test_utils] Do not use dash in env variables' names 8 years ago
Sergey M․ 41c5e60dd5
[test_utils] Fix expand_path tests 8 years ago
Sergey M․ 51098426b8
[utils] Introduce expand_path 8 years ago
Sergey M․ 4b5de77bdb
[utils] Process bytestrings in urljoin (closes #12369) 8 years ago
Yen Chi Hsuan f48409c7ac [utils] Add pkcs1pad
Used in daisuki.net (#4738)
8 years ago
Thomas Christlieb 2af12ad9d2 Introduce get_elements_by_class and get_elements_by_attribute utility functions 8 years ago