示例#1
0
def find_date(html: str, url: str) -> datetime_date:
    """Return the date of the document."""
    # Example for find_any_date(url):
    # http://ftalphaville.ft.com/2012/05/16/1002861/recap-and-tranche-primer/?Authorised=false
    # Example for find_any_date(html):
    # https://www.bbc.com/news/uk-england-25462900
    m = DATE_SEARCH(html)
    return find_any_date(m) if m else find_any_date(url) or find_any_date(html)
示例#2
0
文件: urls.py 项目: 5j9/yadkard
def find_date(html: str, url: str) -> datetime_date:
    """Return the date of the document."""
    # Example for find_any_date(url):
    # http://ftalphaville.ft.com/2012/05/16/1002861/recap-and-tranche-primer/?Authorised=false
    # Example for find_any_date(html):
    # https://www.bbc.com/news/uk-england-25462900
    m = DATE_SEARCH(html)
    return find_any_date(m) if m else find_any_date(url) or find_any_date(html)
示例#3
0
文件: test_fa.py 项目: mavaddat/citer
 def test_arabic_ya(self):
     self.assertEqual(
         find_any_date('تاریخ انتشار : جمعه ۳ ارديبهشت ۱۳۸۹ ساعت ۱۶:۴۸'),
         date(2010, 4, 23))
示例#4
0
def test_arabic_ya():
    assert find_any_date('تاریخ انتشار : جمعه ۳ ارديبهشت ۱۳۸۹ ساعت ۱۶:۴۸') == \
        date(2010, 4, 23)