scrapping berita liputan6.ipynb 26.2 KB
Newer Older
Sartika Aritonang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "#import library\n",
    "import urllib\n",
    "import requests\n",
    "import bs4\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# request a link\n",
    "def request_url(link):\n",
    "    response = requests.get(link)\n",
    "    html = response.text\n",
    "    return html"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Function to parse html\n",
    "def parse_html(to_parse):\n",
    "    soup = bs4.BeautifulSoup(to_parse, 'html.parser')\n",
    "    return soup"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "#take sub menu news form liputan6.com\n",
    "def all_section(main_url):\n",
    "    section_list = []\n",
    "    for i in main_url:\n",
    "        soup = parse_html(request_url(i))\n",
    "        for a in soup.find_all('a', href=True):\n",
    "            if a.text:\n",
    "                section_list.append(a['href'])\n",
    "    return section_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "#get only link about corona or covid\n",
    "def find_corona(main_url):\n",
    "    url_list = []\n",
    "    not_news=[]\n",
    "    for i in main_url:\n",
    "        if i.find('corona')!=-1 or i.find('covid')!=-1 or i.find('pandemi')!=-1 or i.find('psbb')!=-1 or i.find('social-distancing')!=-1:\n",
    "            url_list.append(i)\n",
    "    url_list = list(dict.fromkeys(url_list))\n",
    "    for i in url_list:\n",
    "        if (i.find('read') == -1):\n",
    "            not_news.append(i)       \n",
    "    for j in not_news:\n",
    "        url_list.remove(j)\n",
    "    return url_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "def title(main_url):\n",
    "    titles = []\n",
    "    for i in main_url:\n",
    "        soup=parse_html(request_url(i))\n",
    "        get_title = soup.find(\"h1\", class_=\"read-page--header--title entry-title\")\n",
    "        get_title_photosnews = soup.find(\"h2\", class_=\"read-page--photo-tag--header__title\")\n",
    "        if(get_title):\n",
    "            titles.append(get_title.text)\n",
    "        elif(get_title_photosnews):\n",
    "            titles.append(get_title_photosnews.text)\n",
    "        else:\n",
    "            titles.append('None')\n",
    "    return titles "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "def writer(main_url):\n",
    "    author = []\n",
    "    for i in main_url:\n",
    "        soup=parse_html(request_url(i))\n",
    "        get_author = soup.find(\"span\", class_=\"read-page--header--author__name fn\")\n",
    "        get_editor = soup.find(\"div\", class_=\"read-page--photo-tag--header__credits-user\")\n",
    "        if(get_author):\n",
    "            author.append(get_author.text)\n",
    "        elif(get_editor):\n",
    "            author.append(get_editor.text)\n",
    "        else:\n",
    "            author.append('None')\n",
    "    return author"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "def date(main_url):\n",
    "    datetime = []\n",
    "    for i in main_url:\n",
    "        soup=parse_html(request_url(i))\n",
    "        get_datetime = soup.find(\"time\", class_=\"read-page--header--author__datetime updated\")\n",
    "        get_datetime_photosnews = soup.find(\"time\", class_=\"read-page--photo-tag--header__datetime updated\")\n",
    "        if(get_datetime):\n",
    "            datetime.append(get_datetime.text)\n",
    "        elif(get_datetime_photosnews):\n",
    "            datetime.append(get_datetime_photosnews.text)\n",
    "        else:\n",
    "            datetime.append('None')\n",
    "    return datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "def collect_text(main_url, titles = [], author = [], datetime = []):\n",
    "    paragraf = []\n",
    "    data = []\n",
    "    join =[]\n",
    "    isiteks = []\n",
    "\n",
    "    for i,j in enumerate(main_url):\n",
    "        a = parse_html(request_url(j))\n",
    "        pragraf_text = a.find_all(\"div\", class_=\"article-content-body__item-page\")\n",
    "        pragraf_photos = a.find_all(\"div\", class_=\"read-page--photo-tag--header__content\")\n",
    "        if(pragraf_text):\n",
    "            for k in pragraf_text:\n",
    "                newparagraf = k.find_all('p')\n",
    "                for x in newparagraf:\n",
    "                    paragraf.append(x.text)\n",
    "        else:\n",
    "            for k in pragraf_photos:\n",
    "                paragraf.append(k.text)\n",
    "        data.append(paragraf)\n",
    "        paragraf = []\n",
    "    for i in data:\n",
    "        join.append(' '.join(i))\n",
    "         \n",
    "    for i, j in enumerate(main_url):\n",
    "        isiteks.append({'news': 'Liputan6.com', 'link' : j, 'title': titles[i], 'author' : author[i], 'date_time': datetime[i], 'paragraf' : join[i]})\n",
    "    return isiteks"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "def save_file(file, file_name = ''):\n",
    "    new_file = pd.DataFrame(file, columns=['news','link','title', 'author', 'date_time', 'paragraf'])\n",
    "    new_file.to_csv(file_name + '.csv', index=True, encoding='utf-8', sep = ',')\n",
    "    \n",
    "    return new_file"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_news(main_url, file_name = ''):\n",
    "    section = all_section(main_url)\n",
    "    corona_news = find_corona(section)\n",
    "    titles = title(corona_news)\n",
    "    author = writer(corona_news)\n",
    "    datetime = date(corona_news)\n",
    "    text = collect_text(corona_news, titles, author, datetime)\n",
    "    file = save_file(text, file_name)\n",
    "    \n",
    "    return file "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "url=[\"https://www.liputan6.com/\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>news</th>\n",
       "      <th>link</th>\n",
       "      <th>title</th>\n",
       "      <th>author</th>\n",
       "      <th>date_time</th>\n",
       "      <th>paragraf</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/otomotif/read/4245824...</td>\n",
       "      <td>Lewat Tembang 'Ojo Mudik', Mendiang Didi Kempo...</td>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>05 Mei 2020, 14:01 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta - Didi Kempot merupakan ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/news/read/4216608/lek...</td>\n",
       "      <td>Lekas Pulih Indonesia, Ayo Bantu Mereka yang T...</td>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>01 Apr 2020, 13:03 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta - Liputan6.com bersama B...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/lifestyle/read/424571...</td>\n",
       "      <td>Krisis Corona Covid-19, China Fashion Week 202...</td>\n",
       "      <td>Putu Elmira</td>\n",
       "      <td>05 Mei 2020, 14:01 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta - Ada yang berbeda denga...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/regional/read/4245208...</td>\n",
       "      <td>Kehabisan Reagen, Gorontalo Menumpang Periksa ...</td>\n",
       "      <td>Yoseph Ikanubun</td>\n",
       "      <td>05 Mei 2020, 14:00 WIB</td>\n",
       "      <td>Liputan6.com, Manado - Laboratorium Polymerase...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/global/read/4245828/p...</td>\n",
       "      <td>Pandemi Corona COVID-19 Mulai Mereda, Korsel A...</td>\n",
       "      <td>Tommy Kurnia</td>\n",
       "      <td>05 Mei 2020, 14:00 WIB</td>\n",
       "      <td>Liputan6.com, Seoul - Pemerintah Korea Selatan...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/citizen6/read/4245695...</td>\n",
       "      <td>Diklaim Bisa Cegah Corona, Wanita Ini Rutin Mi...</td>\n",
       "      <td>Camelia</td>\n",
       "      <td>05 Mei 2020, 14:00 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta - Pandemi Corona Covid-1...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/news/read/4245103/fot...</td>\n",
       "      <td>FOTO: Patut Dicontoh, Warga di Perumahan Ini D...</td>\n",
       "      <td>Johan Fatzry</td>\n",
       "      <td>04 Mei 2020, 18:00 WIB</td>\n",
       "      <td>Bahan pangan gratis tersebut diperuntukkan bag...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/news/read/4245178/vid...</td>\n",
       "      <td>VIDEO: Kabar Baik, Laju Kasus Positif Covid-19...</td>\n",
       "      <td>Chandra Bayu Witantra</td>\n",
       "      <td>04 Mei 2020, 20:00 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta Ketua Gugus Tugas Percep...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/showbiz/read/4245155/...</td>\n",
       "      <td>Ari Lasso Beri Semangat pada Masyarakat Lalui ...</td>\n",
       "      <td>Meiristica Nurul</td>\n",
       "      <td>05 Mei 2020, 13:40 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta - Ari Lasso tak bisa tin...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://hot.liputan6.com/read/4245848/7-potret...</td>\n",
       "      <td>7 Potret Belanja Sayur Online saat Social Dist...</td>\n",
       "      <td>Novita Ayuningtyas</td>\n",
       "      <td>05 Mei 2020, 13:35 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta Selama pandemi corona CO...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/news/read/4245749/fot...</td>\n",
       "      <td>FOTO: Perawatan Pasien Gangguan Mental di Masa...</td>\n",
       "      <td>Arny Christika Putri</td>\n",
       "      <td>05 Mei 2020, 13:30 WIB</td>\n",
       "      <td>Pihak panti melakukan pencegahan penyebaran vi...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/news/read/4245868/ceg...</td>\n",
       "      <td>Cegah PHK saat Corona, Zulhas Dorong Subsidi G...</td>\n",
       "      <td>Nanda Perdana Putra</td>\n",
       "      <td>05 Mei 2020, 13:27 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta - Ketua Umum PAN Zulkifl...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/ramadan/read/4245209/...</td>\n",
       "      <td>Ramadan di Tengah Pandemi, Wamenag Zainut Ajak...</td>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>05 Mei 2020, 13:20 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta - Wakil Menteri Agama (W...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/news/read/4245841/upd...</td>\n",
       "      <td>Update Corona DKI Jakarta 5 Mei 2020: 4.641 Po...</td>\n",
       "      <td>Ika Defianti</td>\n",
       "      <td>05 Mei 2020, 13:18 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta - Jumlah kasus positif v...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/bisnis/read/4245822/r...</td>\n",
       "      <td>Rumah Sakit BUMN Telah Rawat 2.000 Pasien Viru...</td>\n",
       "      <td>Tira Santia</td>\n",
       "      <td>05 Mei 2020, 13:15 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta - Kementerian Badan Usah...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/news/read/4245842/pem...</td>\n",
       "      <td>Pemkot Tangerang Jadikan 2 Puskesmas Tempat Is...</td>\n",
       "      <td>Pramita Tristiawati</td>\n",
       "      <td>05 Mei 2020, 13:12 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta - Dua Puskesmas di Kota ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/news/read/4245829/pan...</td>\n",
       "      <td>Pandemi Corona, Tunjangan PNS DKI Dipotong hin...</td>\n",
       "      <td>Ika Defianti</td>\n",
       "      <td>05 Mei 2020, 13:11 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta - Kepala Badan Kepegawai...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/news/read/4245825/men...</td>\n",
       "      <td>Mendagri Minta Pemkot Depok Selesaikan Masalah...</td>\n",
       "      <td>Fachrur Rozie</td>\n",
       "      <td>05 Mei 2020, 13:09 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta - Menteri Dalam Negeri (...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/global/read/4245769/w...</td>\n",
       "      <td>Wabah Corona COVID-19 Reda, 85 juta Warga Chin...</td>\n",
       "      <td>Natasha Khairunisa Amani</td>\n",
       "      <td>05 Mei 2020, 13:02 WIB</td>\n",
       "      <td>Liputan6.com, Beijing - Kementerian Kebudayaan...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/tekno/read/4245801/bs...</td>\n",
       "      <td>BSA Rilis Panduan Atasi Kejahatan Siber di Ten...</td>\n",
       "      <td>Andina Librianty</td>\n",
       "      <td>05 Mei 2020, 13:01 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta - Software Alliance (BSA...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/ramadan/read/4245759/...</td>\n",
       "      <td>Kampanye Ramadan, Ibu Negara UEA Minta Rakyat ...</td>\n",
       "      <td>Tommy Kurnia</td>\n",
       "      <td>05 Mei 2020, 13:00 WIB</td>\n",
       "      <td>Liputan6.com, Abu Dhabi - Pemerintah Uni Emira...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/health/read/4245626/a...</td>\n",
       "      <td>Akurasi Tak Setepat PCR, Gugus Tugas Sebut Rap...</td>\n",
       "      <td>Giovani Dio Prasasti</td>\n",
       "      <td>05 Mei 2020, 13:00 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta Wiku Adisasmito, Ketua T...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/bisnis/read/4245792/s...</td>\n",
       "      <td>Sulit Jual Produk hingga PHK Karyawan, Ini Daf...</td>\n",
       "      <td>Tira Santia</td>\n",
       "      <td>05 Mei 2020, 12:50 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta - Direktur Jenderal Indu...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/cek-fakta/read/424524...</td>\n",
       "      <td>VIDEO CEK FAKTA: Kriminalitas Meningkat di Mas...</td>\n",
       "      <td>Ratu Annisaa Suryasumirat</td>\n",
       "      <td>04 Mei 2020, 20:55 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta Angka kejahatan meningka...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>Liputan6.com</td>\n",
       "      <td>https://www.liputan6.com/cek-fakta/read/424505...</td>\n",
       "      <td>Cek Fakta: Tidak Benar Presiden Jokowi Menaikk...</td>\n",
       "      <td>Hanz Jimenez Salim</td>\n",
       "      <td>04 Mei 2020, 17:33 WIB</td>\n",
       "      <td>Liputan6.com, Jakarta - Kabar tentang Presiden...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            news                                               link  \\\n",
       "0   Liputan6.com  https://www.liputan6.com/otomotif/read/4245824...   \n",
       "1   Liputan6.com  https://www.liputan6.com/news/read/4216608/lek...   \n",
       "2   Liputan6.com  https://www.liputan6.com/lifestyle/read/424571...   \n",
       "3   Liputan6.com  https://www.liputan6.com/regional/read/4245208...   \n",
       "4   Liputan6.com  https://www.liputan6.com/global/read/4245828/p...   \n",
       "5   Liputan6.com  https://www.liputan6.com/citizen6/read/4245695...   \n",
       "6   Liputan6.com  https://www.liputan6.com/news/read/4245103/fot...   \n",
       "7   Liputan6.com  https://www.liputan6.com/news/read/4245178/vid...   \n",
       "8   Liputan6.com  https://www.liputan6.com/showbiz/read/4245155/...   \n",
       "9   Liputan6.com  https://hot.liputan6.com/read/4245848/7-potret...   \n",
       "10  Liputan6.com  https://www.liputan6.com/news/read/4245749/fot...   \n",
       "11  Liputan6.com  https://www.liputan6.com/news/read/4245868/ceg...   \n",
       "12  Liputan6.com  https://www.liputan6.com/ramadan/read/4245209/...   \n",
       "13  Liputan6.com  https://www.liputan6.com/news/read/4245841/upd...   \n",
       "14  Liputan6.com  https://www.liputan6.com/bisnis/read/4245822/r...   \n",
       "15  Liputan6.com  https://www.liputan6.com/news/read/4245842/pem...   \n",
       "16  Liputan6.com  https://www.liputan6.com/news/read/4245829/pan...   \n",
       "17  Liputan6.com  https://www.liputan6.com/news/read/4245825/men...   \n",
       "18  Liputan6.com  https://www.liputan6.com/global/read/4245769/w...   \n",
       "19  Liputan6.com  https://www.liputan6.com/tekno/read/4245801/bs...   \n",
       "20  Liputan6.com  https://www.liputan6.com/ramadan/read/4245759/...   \n",
       "21  Liputan6.com  https://www.liputan6.com/health/read/4245626/a...   \n",
       "22  Liputan6.com  https://www.liputan6.com/bisnis/read/4245792/s...   \n",
       "23  Liputan6.com  https://www.liputan6.com/cek-fakta/read/424524...   \n",
       "24  Liputan6.com  https://www.liputan6.com/cek-fakta/read/424505...   \n",
       "\n",
       "                                                title  \\\n",
       "0   Lewat Tembang 'Ojo Mudik', Mendiang Didi Kempo...   \n",
       "1   Lekas Pulih Indonesia, Ayo Bantu Mereka yang T...   \n",
       "2   Krisis Corona Covid-19, China Fashion Week 202...   \n",
       "3   Kehabisan Reagen, Gorontalo Menumpang Periksa ...   \n",
       "4   Pandemi Corona COVID-19 Mulai Mereda, Korsel A...   \n",
       "5   Diklaim Bisa Cegah Corona, Wanita Ini Rutin Mi...   \n",
       "6   FOTO: Patut Dicontoh, Warga di Perumahan Ini D...   \n",
       "7   VIDEO: Kabar Baik, Laju Kasus Positif Covid-19...   \n",
       "8   Ari Lasso Beri Semangat pada Masyarakat Lalui ...   \n",
       "9   7 Potret Belanja Sayur Online saat Social Dist...   \n",
       "10  FOTO: Perawatan Pasien Gangguan Mental di Masa...   \n",
       "11  Cegah PHK saat Corona, Zulhas Dorong Subsidi G...   \n",
       "12  Ramadan di Tengah Pandemi, Wamenag Zainut Ajak...   \n",
       "13  Update Corona DKI Jakarta 5 Mei 2020: 4.641 Po...   \n",
       "14  Rumah Sakit BUMN Telah Rawat 2.000 Pasien Viru...   \n",
       "15  Pemkot Tangerang Jadikan 2 Puskesmas Tempat Is...   \n",
       "16  Pandemi Corona, Tunjangan PNS DKI Dipotong hin...   \n",
       "17  Mendagri Minta Pemkot Depok Selesaikan Masalah...   \n",
       "18  Wabah Corona COVID-19 Reda, 85 juta Warga Chin...   \n",
       "19  BSA Rilis Panduan Atasi Kejahatan Siber di Ten...   \n",
       "20  Kampanye Ramadan, Ibu Negara UEA Minta Rakyat ...   \n",
       "21  Akurasi Tak Setepat PCR, Gugus Tugas Sebut Rap...   \n",
       "22  Sulit Jual Produk hingga PHK Karyawan, Ini Daf...   \n",
       "23  VIDEO CEK FAKTA: Kriminalitas Meningkat di Mas...   \n",
       "24  Cek Fakta: Tidak Benar Presiden Jokowi Menaikk...   \n",
       "\n",
       "                       author               date_time  \\\n",
       "0                Liputan6.com  05 Mei 2020, 14:01 WIB   \n",
       "1                Liputan6.com  01 Apr 2020, 13:03 WIB   \n",
       "2                 Putu Elmira  05 Mei 2020, 14:01 WIB   \n",
       "3             Yoseph Ikanubun  05 Mei 2020, 14:00 WIB   \n",
       "4                Tommy Kurnia  05 Mei 2020, 14:00 WIB   \n",
       "5                     Camelia  05 Mei 2020, 14:00 WIB   \n",
       "6                Johan Fatzry  04 Mei 2020, 18:00 WIB   \n",
       "7       Chandra Bayu Witantra  04 Mei 2020, 20:00 WIB   \n",
       "8            Meiristica Nurul  05 Mei 2020, 13:40 WIB   \n",
       "9          Novita Ayuningtyas  05 Mei 2020, 13:35 WIB   \n",
       "10       Arny Christika Putri  05 Mei 2020, 13:30 WIB   \n",
       "11        Nanda Perdana Putra  05 Mei 2020, 13:27 WIB   \n",
       "12               Liputan6.com  05 Mei 2020, 13:20 WIB   \n",
       "13               Ika Defianti  05 Mei 2020, 13:18 WIB   \n",
       "14                Tira Santia  05 Mei 2020, 13:15 WIB   \n",
       "15        Pramita Tristiawati  05 Mei 2020, 13:12 WIB   \n",
       "16               Ika Defianti  05 Mei 2020, 13:11 WIB   \n",
       "17              Fachrur Rozie  05 Mei 2020, 13:09 WIB   \n",
       "18   Natasha Khairunisa Amani  05 Mei 2020, 13:02 WIB   \n",
       "19           Andina Librianty  05 Mei 2020, 13:01 WIB   \n",
       "20               Tommy Kurnia  05 Mei 2020, 13:00 WIB   \n",
       "21       Giovani Dio Prasasti  05 Mei 2020, 13:00 WIB   \n",
       "22                Tira Santia  05 Mei 2020, 12:50 WIB   \n",
       "23  Ratu Annisaa Suryasumirat  04 Mei 2020, 20:55 WIB   \n",
       "24         Hanz Jimenez Salim  04 Mei 2020, 17:33 WIB   \n",
       "\n",
       "                                             paragraf  \n",
       "0   Liputan6.com, Jakarta - Didi Kempot merupakan ...  \n",
       "1   Liputan6.com, Jakarta - Liputan6.com bersama B...  \n",
       "2   Liputan6.com, Jakarta - Ada yang berbeda denga...  \n",
       "3   Liputan6.com, Manado - Laboratorium Polymerase...  \n",
       "4   Liputan6.com, Seoul - Pemerintah Korea Selatan...  \n",
       "5   Liputan6.com, Jakarta - Pandemi Corona Covid-1...  \n",
       "6   Bahan pangan gratis tersebut diperuntukkan bag...  \n",
       "7   Liputan6.com, Jakarta Ketua Gugus Tugas Percep...  \n",
       "8   Liputan6.com, Jakarta - Ari Lasso tak bisa tin...  \n",
       "9   Liputan6.com, Jakarta Selama pandemi corona CO...  \n",
       "10  Pihak panti melakukan pencegahan penyebaran vi...  \n",
       "11  Liputan6.com, Jakarta - Ketua Umum PAN Zulkifl...  \n",
       "12  Liputan6.com, Jakarta - Wakil Menteri Agama (W...  \n",
       "13  Liputan6.com, Jakarta - Jumlah kasus positif v...  \n",
       "14  Liputan6.com, Jakarta - Kementerian Badan Usah...  \n",
       "15  Liputan6.com, Jakarta - Dua Puskesmas di Kota ...  \n",
       "16  Liputan6.com, Jakarta - Kepala Badan Kepegawai...  \n",
       "17  Liputan6.com, Jakarta - Menteri Dalam Negeri (...  \n",
       "18  Liputan6.com, Beijing - Kementerian Kebudayaan...  \n",
       "19  Liputan6.com, Jakarta - Software Alliance (BSA...  \n",
       "20  Liputan6.com, Abu Dhabi - Pemerintah Uni Emira...  \n",
       "21  Liputan6.com, Jakarta Wiku Adisasmito, Ketua T...  \n",
       "22  Liputan6.com, Jakarta - Direktur Jenderal Indu...  \n",
       "23  Liputan6.com, Jakarta Angka kejahatan meningka...  \n",
       "24  Liputan6.com, Jakarta - Kabar tentang Presiden...  "
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "liputan6_news=get_news(url, file_name = 'liputan6_satu')\n",
    "liputan6_news"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}