question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Some mpd manifests give float() argument must be a string or a number, not 'NoneType'

See original GitHub issue

Checklist

  • I’m reporting a bug unrelated to a specific site
  • I’ve verified that I’m running yt-dlp version 2022.02.04. (update instructions)
  • I’ve checked that all provided URLs are alive and playable in a browser
  • I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
  • I’ve searched the bugtracker for similar issues including closed ones. DO NOT post duplicates
  • I’ve read the guidelines for opening an issue

Description

I was trying to check the available video formats from a dash manifest but I got this error.

Verbose log

yt-dlp -vU -F --allow-un "https://dtvott-abc.akamaized.net/dash_live_1125/manifest.mpd"
[debug] Command-line config: ['-vU', '-F', '--allow-un', 'https://dtvott-abc.akamaized.net/dash_live_1125/manifest.mpd']
WARNING: You have asked for UNPLAYABLE formats to be listed/downloaded. This is a developer option intended for debugging.
         If you experience any issues while using this option, DO NOT open a bug report
[debug] Encodings: locale cp1252, fs utf-8, out utf-8 (No ANSI), err utf-8 (No ANSI), pref cp1252
[debug] yt-dlp version 2022.02.04 [c1653e9] (win_exe)
[debug] Python version 3.8.10 (CPython 64bit) - Windows-8.1-6.3.9600-SP0
[debug] exe versions: ffmpeg 2021-06-23-git-947122f111-full_build-www.gyan.dev (setts), ffprobe 2021-06-23-git-947122f111-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome, mutagen, sqlite, websockets
[debug] Proxy map: {}
Latest version: 2022.02.04, Current version: 2022.02.04
yt-dlp is up to date (2022.02.04)
[debug] [generic] Extracting URL: https://dtvott-abc.akamaized.net/dash_live_1125/manifest.mpd
[generic] manifest: Requesting header
WARNING: [generic] Falling back on generic information extractor.
[generic] manifest: Downloading webpage
[generic] manifest: Extracting information
ERROR: float() argument must be a string or a number, not 'NoneType'
Traceback (most recent call last):
  File "yt_dlp\YoutubeDL.py", line 1381, in wrapper
  File "yt_dlp\YoutubeDL.py", line 1451, in __extract_info
  File "yt_dlp\extractor\common.py", line 612, in extract
  File "yt_dlp\extractor\generic.py", line 2824, in _real_extract
  File "yt_dlp\extractor\common.py", line 2878, in _parse_mpd_formats_and_subtitles
TypeError: float() argument must be a string or a number, not 'NoneType'

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
pukkandancommented, Feb 17, 2022
WARNING: You have asked for UNPLAYABLE formats to be listed/downloaded. This is a developer option intended for debugging.
         If you experience any issues while using this option, DO NOT open a bug report

Normally I would simply close this issue. But in this specific case, there is a storyboards format in the manifest that can be extracted without the use of --allow-unplayable-formats

1reaction
dirkfcommented, Feb 11, 2022

This patch, using the above tactic, fixes the problem URL, though possibly not all cases where the duration is not known from the AdaptationSet itself:

--- old/yt-dlp/yt_dlp/extractor/common.py
+++ new/yt-dlp/yt_dlp/extractor/common.py
@@ -75,6 +75,7 @@
     str_to_int,
     strip_or_none,
     traverse_obj,
+    try_get,
     unescapeHTML,
     UnsupportedError,
     unified_strdate,
@@ -2966,6 +2967,10 @@
                                 f['url'] = initialization_url
                             f['fragments'].append({location_key(initialization_url): initialization_url})
                         f['fragments'].extend(representation_ms_info['fragments'])
+                        if period_duration is None:
+                            period_duration = try_get(
+                                representation_ms_info,
+                                lambda r: sum(frag['duration'] for frag in r['fragments']), float)
                     else:
                         # Assuming direct URL to unfragmented media.
                         f['url'] = base_url

The video formats only appear with --allow-unplayable-formats.

Read more comments on GitHub >

github_iconTop Results From Across the Web

float() argument must be string or real number, not NoneType
The Python "TypeError: float() argument must be a string or a real number, not 'NoneType'" occurs when we pass a None value to...
Read more >
TypeError: float() argument must be a string or a number, not ...
I am very dumb the input lines under secition ##variable inputs needed to read: ##variable inputs massCarbonDioxide = float(input("What is ...
Read more >
pybind11 Documentation - Read the Docs
pybind11 is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python.
Read more >
What's New — pandas 0.19.2 documentation
Compat with python 3.6 for pickling of some offsets (GH14685) ... Bug in pd.to_datetime() when passing integers or floats, and no unit and...
Read more >
Release 0.55.0rc1+0.gf2a673cd0.dirty-py3.7-linux-x86_64 ...
The @jit decorator must be added to any such library function, ... When we call f() with integer arguments, not only do we...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found