markitdown icon indicating copy to clipboard operation
markitdown copied to clipboard

Youtube converter error: no element found: line 1, column 0

Open qubydev opened this issue 1 year ago • 5 comments

main.py:

from markitdown import MarkItDown

md = MarkItDown(enable_plugins=False)
result = md.convert("https://www.youtube.com/watch?v=GOejI6c0CMQ")
print(result.text_content)

output:

(.venv) PS C:\Users\malay\OneDrive\Documents\Open Source\markitdown> python main.py
C:\Users\malay\OneDrive\Documents\Open Source\markitdown\.venv\Lib\site-packages\pydub\utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
  warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
Attempt 1 failed: no element found: line 1, column 0
Attempt 2 failed: no element found: line 1, column 0
Attempt 3 failed: no element found: line 1, column 0
[About](https://www.youtube.com/about/)[Press](https://www.youtube.com/about/press/)[Copyright](https://www.youtube.com/about/copyright/)[Contact us](/t/contact_us/)[Creator](https://www.youtube.com/creators/)[Advertise](https://www.youtube.com/ads/)[Developers](https://developers.google.com/youtube)[Terms](/t/terms)[Privacy](/t/privacy)[Policy & Safety](https://www.youtube.com/about/policies/)[How YouTube works](https://www.youtube.com/howyoutubeworks?utm_campaign=ytgen&utm_source=ythp&utm_medium=LeftNav&utm_content=txt&u=https%3A%2F%2Fwww.youtube.com%2Fhowyoutubeworks%3Futm_source%3Dythp%26utm_medium%3DLeftNav%26utm_campaign%3Dytgen)[Test new features](/new)

© 2025 Google LLC

cause: In youtube-transcript-api~=1.0.0 this problem exists for some reason which was fixed after v1.1.0 (Reference)

qubydev avatar Sep 20 '25 12:09 qubydev

For those using UV and needs a quick fix before the next release, add the following to your pyproject.toml:

[tool.uv]
override-dependencies = ["youtube-transcript-api>=1.2.2"] 

SeeYangZhi avatar Sep 23 '25 09:09 SeeYangZhi

The solution is to simply upgrade the library.

If the issue still persist then I would suggest you to try out a simple script using youtube-transcript-api and see if it's working, as it is not accessible in many countries.

qubydev avatar Sep 23 '25 09:09 qubydev

It appears this issue is still present in the latest version of markitdown. While youtube-transcript-api is at v1.2.3, the current markitdown release seems to be pinned to (or pulling) the older version ("youtube-transcript-api~=1.0.0" - from the pyproject.toml).

Overriding the dependency with uv fixes it locally, but it would be nice to have it fixed upstream.

kaikozlov avatar Jan 22 '26 20:01 kaikozlov

This issue is closed as completed, but the fix never shipped — it still reproduces on the latest release.

markitdown[all]==0.1.6 (released 2026-05-26) pins youtube-transcript-api~=1.0.0, which resolves to 1.0.3. On that version YouTubeTranscriptApi.fetch() gets an empty body and dies with xml.etree.ElementTree.ParseError: no element found: line 1, column 0 (YouTube no longer serves the timedtext payload to the 1.0.x code path). The converter then raises, and MarkItDown silently falls back to the generic HTML converter — so the result is the page footer ("© 2026 Google LLC" links) instead of the transcript, with a 0 exit code and no error surfaced.

Minimal repro on a clean env (any video that has captions):

uv pip install --prerelease=allow 'markitdown[all]==0.1.6'
python -c "from markitdown import MarkItDown; print(MarkItDown(enable_plugins=False).convert('https://www.youtube.com/watch?v=VIDEO_ID').text_content[:200])"
# -> "[About](...)[Press](...)[Copyright](...)"  (page footer, no transcript)

The fix is a one-line constraint bump: youtube-transcript-api>=1.2.x handles the current fetch path (verified locally — full transcript fetched). The youtube-transcription extra is already unpinned; only the all extra still carries the broken ~=1.0.0.

There are already several open, mergeable PRs doing exactly this — #1430 (open since 2025-09), #1732, #1868, #2077 — none reviewed yet.

Could this be reopened? As it stands, every markitdown[all] user gets silent, transcript-less output on YouTube URLs.

lexfrei avatar Jun 07 '26 13:06 lexfrei

Quick fix if you have installed markitdown via pipx:

Below command will upgrade youtube-transcript-api dependency of markitdown package.

pipx runpip markitdown install --upgrade youtube-transcript-api

erenseymen avatar Sep 18 '26 18:09 erenseymen