File size: 513 Bytes
72eedb2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d01d94a
72eedb2
 
 
6afd852
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from newspaper import Article

def Scrap(url):
    """
    Scrap article from url

    ### Parameter\n
    url : article url (dtype: `string`)\n
    summarize : do you want to summarize the article? (dtype: `boolean`)

    ### Result\n
    return the article text (dtype: `string`)
    """
    
    article = Article(url, language='id')
    article.download()
    article.parse()

    if not article.text or not article.title:
        print("Can't Scrap this article link")
        return None

    return article