Commit graph

228 commits

Author SHA1 Message Date
Remita Amine e88c9ef62a [utils] add a function to clean podcast URLs 2021-01-04 01:14:25 +01:00
Remita Amine 9dd674e1d2 [utils] accept only supported protocols in url_or_none 2020-12-30 09:22:30 +01:00
Sergey M․ fe07e788bf
[utils] Skip ! prefixed code in js_to_json 2020-11-17 01:30:43 +07:00
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.
2020-10-18 00:10:41 +07:00
Sergey M․ 1d9bf655e6
[utils] Recognize wav mimetype (closes #26463) 2020-09-06 11:19:53 +07:00
Sergey M․ 42db58ec73
[utils] Improve str_to_int 2019-12-15 23:15:24 +07:00
Remita Amine 348c6bf1c1 [utils] handle int values passed to str_to_int 2019-11-29 17:39:18 +01:00
Sergey M․ 1ced222120
[utils] Add generic caesar cipher and rot47 2019-11-27 02:26:42 +07:00
InfernalUnderling 9d30c2132a [utils] Handle rd-suffixed day parts in unified_strdate (#23199) 2019-11-27 00:08:37 +07:00
Sergey M․ 824fa51165
[utils] Improve subtitles_filename (closes #22753) 2019-10-18 04:03:53 +07:00
Sergey M․ 28cc2241e4
[utils] Restrict parse_codecs and add theora as known vcodec (#21381) 2019-06-14 01:56:17 +07:00
Sergey M․ 53cd37bac5
[utils] Improve strip_or_none 2019-05-24 00:03:01 +07:00
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
2019-05-11 01:42:31 +07:00
Sergey M․ 5e1271c56d
[utils] Improve int_or_none and float_or_none (#20403) 2019-03-23 01:08:54 +07:00
Sergey M․ 0dc41787af
[utils] Introduce parse_bitrate 2019-03-17 09:07:47 +07:00
Sergey M․ fad4ceb534
[utils] Fix urljoin for paths with non-http(s) schemes 2019-01-20 20:22:19 +07:00
Sergey M․ 25d110be30
[utils] Properly recognize AV1 codec (closes #17506) 2018-09-10 02:37:22 +07:00
Sergey M․ af03000ad5
[utils] Introduce url_or_none 2018-07-21 18:03:58 +07:00
Sergey M․ e9c671d5e8
[utils] Allow JSONP with empty func name (closes #17028) 2018-07-21 12:30:18 +07:00
Enes 85750f8972 [openload] Improve ext extraction 2018-06-02 00:16:22 +07:00
Remita Amine 3bb3ff38a1 [test_utils] add tests for b836118724 2018-05-23 12:20:05 +01:00
Sergey M․ 6cc622327f
[utils] Introduce merge_dicts 2018-04-28 02:47:17 +07:00
Sergey M․ 1cc47c6674
[utils] Fix match_str for boolean meta fields 2018-04-24 23:54:49 +07:00
Philipp Hagemeister f226880c6d [tennistv] Add support for tennistv.com 2018-03-14 09:55:21 +01:00
Sergey M․ b871d7e954
[utils] Add parse_resolution 2018-03-02 23:39:04 +07:00
Sergey M․ befa4708fd
[utils] Fixup some common URL's typos in sanitize_url (closes #15649) 2018-02-19 22:50:23 +07:00
Sergey M․ c707b1d828
[test_utils] Add tests for malformed JSON handling in js_to_json 2018-01-20 23:00:09 +07:00
Mike Fährmann c384d537f8 [util] Improve scientific notation handling in js_to_json (closes #14789) 2018-01-20 22:54:21 +07:00
Sergey M․ b555ae9bf1
[utils] Add another date format pattern (#14999) 2017-12-16 21:56:16 +07:00
Sergey M․ 056653bbb1
[utils] Add support for zero years and months in parse_duration 2017-10-29 07:04:48 +07:00
Yen Chi Hsuan 3869028ffb [utils] Use bytes-like objects in dfxp2srt
This fixes handling of non-UTF8 TTML subtitles

Closes #14191
2017-09-16 12:18:38 +08:00
Yen Chi Hsuan 95f3f7c20a
[utils] Fix unescapeHTML for misformed string like "&a"" (#13935) 2017-08-19 21:40:53 +08:00
Sergey M․ 5b232f46dc
[utils] Skip missing params in cli_bool_option (closes #13865) 2017-08-09 22:28:19 +07:00
Sergey M․ dee2ff1d81
[test_utils] Fix tests under Windows 2017-07-06 00:25:37 +07:00
Yen Chi Hsuan 609ff8ca19 [utils] Support attributes with no values in get_elements_by_attribute() 2017-07-05 23:27:12 +08:00
Sergey M․ b4a3d461e4
[utils] Handle HTMLParseError in extract_attributes (closes #13349) 2017-06-12 01:52:24 +07:00
Sergey M․ 2ae2ffda5e
[utils] Improve unified_timestamp 2017-06-11 21:27:22 +07:00
Yen Chi Hsuan 5552c9eb0f
[utils] Recognize more patterns in strip_jsonp()
Used in Youku Show pages
2017-05-26 21:58:18 +08:00
Yen Chi Hsuan 0c26548601
[cda] Implement birthday verification (closes #12789) 2017-05-04 16:26:17 +08:00
Sergey M․ deef31955b
[utils] Improve unified_timestamp
Seen at http://zaq1.pl/video/xev0e
2017-04-30 21:45:53 +07:00
Tithen-Firion 9222d94510 [test_utils] Add one more clean_html test 2017-04-28 18:05:14 +02:00
Remita Amine 5b995f713b [utils] add support for ttml styles 2017-04-19 14:38:40 +01:00
Sergey M․ a426ef6d78
[test_utils] Do not use dash in env variables' names 2017-03-26 03:22:48 +07:00
Sergey M․ 41c5e60dd5
[test_utils] Fix expand_path tests 2017-03-26 03:07:56 +07:00
Sergey M․ 51098426b8
[utils] Introduce expand_path 2017-03-26 02:30:10 +07:00
Sergey M․ 4b5de77bdb
[utils] Process bytestrings in urljoin (closes #12369) 2017-03-06 03:57:46 +07:00
Yen Chi Hsuan f48409c7ac [utils] Add pkcs1pad
Used in daisuki.net (#4738)
2017-02-28 22:10:31 +08:00
Thomas Christlieb 2af12ad9d2 Introduce get_elements_by_class and get_elements_by_attribute utility functions 2017-02-11 17:16:54 +08:00
Sergey M․ 4195096ea8
[utils] Improve comments processing in js_to_json (closes #11947) 2017-02-03 03:04:33 +07:00
Michal Čihař b3ee552e4b
[utils] Handle single-line comments in js_to_json 2017-02-03 03:04:33 +07:00