Visitar URL original
The script does not find the date (Russian) · Issue #156 · adbar/htmldate · GitHub
Skip to content

The script does not find the date (Russian) #156

Open

Description

@PetroffSky

The script does not find the date (Russian):
from htmldate import find_date

url = "https://kamaz.ru/press/releases/kamaz_i_skolkovo_sozdadut_ekologicheski_chistyy_gruzovik/"

print(find_date(url, extensive_search=True)) # Returns None
print(find_date(url, extensive_search=False)) # Returns None

Xpath selector of dates on the page: //div[contains(text(), 'July 30, 2015')]

Activity

  1. adbar commented on Jul 16, 2024

    @adbar
    Owner

    Something has to be added to the extractors otherwise the div element will not be processed (e.g. class contains "news" or "detail").

  2. PetroffSky commented on Jul 17, 2024

    @PetroffSky
    Author

    Hello! I'm sorry. My mistake. Here is the correct xpath:
    //div[contains(text(), '30 Июля 2015')]
    also the names of the months in Russian in order in two versions:
    months = ['январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь']
    or
    months = ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря']

  3. adbar commented on Jul 19, 2024

    @adbar
    Owner

    I meant that someone need to add a precise XPath target, using //div[contains(text())] or simply //div//text() would be bad for accuracy because random dates in a text are often irrelevant.

    As for the months if you're interested you could add them to the extractor in a pull request.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions