Skip to content

Clean title come from meta tags#824

Open
cikay wants to merge 5 commits into
adbar:masterfrom
cikay:title-extraction
Open

Clean title come from meta tags#824
cikay wants to merge 5 commits into
adbar:masterfrom
cikay:title-extraction

Conversation

@cikay

@cikay cikay commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

Apply HTMLTITLE_REGEX cleanup to titles extracted from og:title, twitter:title, meta name title, and itemprop headline. Previously, extract() with with_metadata=True returned titles with site name suffixes from meta tags, while extract_title() correctly returned clean titles from h1 tags.

  • Add clean_title() helper function to remove site name suffix/prefix
  • Apply clean_title() in extract_opengraph() for og:title
  • Apply clean_title() in examine_meta() for meta name titles and itemprop headlines
  • Add tests for clean_title() and title cleaning in metadata extraction

The issue is encountered in the following website
https://www.nuhev.com

example url: https://www.nuhev.com/gelo-jiyan-de-li-sala-2050yan-cawa-be/

titles from meta: <meta property="og:title" content="Gelo Jîyan dê li Sala 2050yan Çawa Be? - Nûhev Co. %100 Kurdî">
titles from h1: <h1 class="jeg_post_title">Gelo Jîyan dê li Sala 2050yan Çawa Be?</h1>

@adbar

adbar commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Hi @cikay, your PR looks OK but for some reason the tests haven't run.

I suggest you edit your PR or add a commit like git commit --allow-empty -m "ci: retrigger" && git push to hopefully bypass this Github issue.

@cikay

cikay commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

Hi @cikay, your PR looks OK but for some reason the tests haven't run.

I suggest you edit your PR or add a commit like git commit --allow-empty -m "ci: retrigger" && git push to hopefully bypass this Github issue.

Thanks. I just did

@adbar

adbar commented Jul 5, 2026

Copy link
Copy Markdown
Owner

@cikay Are you still working on the PR? Maybe it's now fixed due to the recent changes.

@cikay

cikay commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

@cikay Are you still working on the PR? Maybe it's now fixed due to the recent changes.

Still the same

>>> output_string = extract(downloaded, output_format="json", with_metadata=True, include_comments=False)
>>> output = json.loads(output_string)
>>> output["title"]
'Gelo Jîyan dê li Sala 2050yan Çawa Be? - Nûhev Co. %100 Kurdî'
>>> 

@cikay

cikay commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Existing tests have failed now. We have to find a reliable signal for a clean title.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants