File size: 497 Bytes
72eedb2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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:
        print("Can't Scrap this article link")
        return None

    return article.text