microsoft / microsoft/markitdown
bug: markitdown fails with 403 Forbidden when converting Zhihu article URL
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 186k
- Forks
- 13.7k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 49
Description
When attempting to convert a Zhihu article using the CLI tool, markitdown throws an unhandled exception due to a 403 Forbidden response from the target URL.
Reproduction Steps:
markitdown https://zhuanlan.zhihu.com/p/11654788270 > test.md
Error Traceback:
Traceback (most recent call last):
File "/Users/xiongxinwei/Library/Caches/pypoetry/virtualenvs/telepace-server-WT4oou3h-py3.12/bin/markitdown", line 8, in <module>
sys.exit(main())
^^^^^^
File ".../markitdown/__main__.py", line 197, in main
result = markitdown.convert(
^^^^^^^^^^^^^^^^^^^
File ".../markitdown/_markitdown.py", line 271, in convert
return self.convert_uri(source, stream_info=stream_info, **_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../markitdown/_markitdown.py", line 443, in convert_uri
response.raise_for_status()
File ".../site-packages/requests/models.py", line 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://zhuanlan.zhihu.com/p/11654788270
Expected Behavior:
The tool should either:
- Successfully fetch and convert the article if access is allowed, or
- Gracefully handle 403 responses with a clear error message indicating access is denied.
Environment:
- OS: macOS
- Python: 3.12
- Tool version: latest from repo
- Installed via: Poetry
Possible Cause:
Zhihu may be blocking automated requests. It might be necessary to:
- Add custom headers (e.g., a user-agent string) to mimic a browser
- Handle HTTP errors more gracefully
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in markitdown/_markitdown.py at convert_uri, where the traceback shows response.raise_for_status(), and review the CLI entry point in markitdown/main.py. Reproduce the Zhihu URL with the documented command, then verify that a 403 is handled with a clear access-denied error or that conversion succeeds when access is allowed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100