scraping data inipasti.ipynb 32.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 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753
{
 "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\n",
    "import re"
   ]
  },
  {
   "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 inipasti.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": [
    "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",
    "    return url_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "def writer(main_url):\n",
    "    author = []\n",
    "    for i in main_url:\n",
    "        a = parse_html(request_url(i))\n",
    "        try:\n",
    "            b = a.find(\"div\", class_ = \"td-author-name vcard author\")    \n",
    "            if b:\n",
    "                c = b.find(\"a\")\n",
    "                author.append(c.text)\n",
    "            else:\n",
    "                author.append('None')\n",
    "        except :\n",
    "            author.append('None')\n",
    "            \n",
    "    return author"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "def title(main_url):\n",
    "    titles = []\n",
    "    for i in main_url:\n",
    "        soup = parse_html(request_url(i))\n",
    "        try :\n",
    "            h1 = soup.select('h1', {'class' : 'entry-title td-module-title'})[0].text.strip()\n",
    "            titles.append(h1)\n",
    "        except :\n",
    "            titles.append('None')\n",
    "    return titles"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "def date(main_url):\n",
    "    dates = []\n",
    "    for i in main_url:\n",
    "        a = parse_html(request_url(i))\n",
    "        try:\n",
    "            b = a.find(\"span\", class_ = \"td-post-date\").text\n",
    "            c = re.sub(\"Inipasti.com - \", \"\", b)\n",
    "            dates.append(c)\n",
    "        except:\n",
    "            dates.append('None')\n",
    "    return dates"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "def collect_text(main_url, titles = [], author = [], dates = []):\n",
    "    paragraf = []\n",
    "    data = []\n",
    "    join =[]\n",
    "    isiteks = []\n",
    "    #collect all text with tag <p> from articles    \n",
    "    for i,j in enumerate(main_url):\n",
    "        a = parse_html(request_url(j))\n",
    "        try:\n",
    "            content = a.find('div', class_='td-post-content')\n",
    "            pragraf = content.find_all('p')\n",
    "            for k in pragraf:\n",
    "                paragraf.append(k.text)\n",
    "            data.append(paragraf)\n",
    "            paragraf = []\n",
    "        except:\n",
    "            data.append('None')\n",
    "    for i in data:\n",
    "        join.append(' '.join(i))\n",
    "        \n",
    "    #collect articles and urls in one variable  \n",
    "    for i, j in enumerate(main_url):\n",
    "        isiteks.append({'news' : 'Inipasti.com', 'link' : j, 'title' : titles[i], 'author' : author[i], 'date_time' : dates[i], 'paragraf' : join[i] })\n",
    "    return isiteks"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "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": 11,
   "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": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "main_url=[\"https://inipasti.com/\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "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>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/category/kesehatan/corona...</td>\n",
       "      <td>Coronavirus</td>\n",
       "      <td>None</td>\n",
       "      <td>Mei 1, 2020 2:10 pm</td>\n",
       "      <td>N o n e</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/dalam-bayang-bayang-coron...</td>\n",
       "      <td>Dalam Bayang-bayang Coronavirus, Umat Islam di...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>April 21, 2020 10:37 am</td>\n",
       "      <td>INIPASTI.COM, ALGIERS / CAIRO / JAKARTA – Bebe...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/trump-menjanjikan-vaksin-...</td>\n",
       "      <td>Trump Menjanjikan Vaksin Covid-19 pada Akhir T...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 4, 2020 10:52 am</td>\n",
       "      <td>INIPASTI.COM, Presiden Donald Trump meluncurka...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/partai-gelora-bagi-bantua...</td>\n",
       "      <td>Partai Gelora Bagi Bantuan Sembako ke Warga Te...</td>\n",
       "      <td>Muhammad Seilessy</td>\n",
       "      <td>Mei 3, 2020 5:48 pm</td>\n",
       "      <td>INIPASTI.COM, MAKASSAR, – DPD Partai Gelora In...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/para-pengajarnya-selebrit...</td>\n",
       "      <td>Para Pengajarnya Selebritis, Startup Kelas Onl...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 5, 2020 9:08 am</td>\n",
       "      <td>INIPASTI.COM, MasterClass, sebuah startup yang...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/tanggap-pandemi-satgas-co...</td>\n",
       "      <td>Tanggap Pandemi, Satgas Covid-19 Unhas Terima ...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>April 23, 2020 5:50 pm</td>\n",
       "      <td>INIPASTI.COM, MAKASSAR – Satuan Tugas Pencegah...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/pasien-eks-covid-19-dikun...</td>\n",
       "      <td>Pasien Eks Covid-19 dikunjungi Tim Gugus Tugas...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 5, 2020 2:19 pm</td>\n",
       "      <td>INIPASTI.COM, PASANGKAYU– Satu pasien Covid-19...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/terkait-rencana-psbb-di-s...</td>\n",
       "      <td>Terkait Rencana PSBB di Sulbar,Ini Masukan Pem...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 4, 2020 4:54 am</td>\n",
       "      <td>INIPASTI.COM, PASANGKAYU – Pemprov Sulbar ikut...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/psbb-makassar-diperpanjan...</td>\n",
       "      <td>PSBB Makassar Diperpanjang 14 Hari, Petugas Di...</td>\n",
       "      <td>Muhammad Seilessy</td>\n",
       "      <td>Mei 6, 2020 5:08 pm</td>\n",
       "      <td>INIPASTI.COM, MAKASSAR, — Pembatasan Sosial Be...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/ajiep-surati-pimpinan-dpd...</td>\n",
       "      <td>Ajiep Surati Pimpinan DPD Terkait Postur APBN ...</td>\n",
       "      <td>Muhammad Seilessy</td>\n",
       "      <td>April 10, 2020 2:03 pm</td>\n",
       "      <td>INIPASTI.COM, MAKASSAR, — Anggota Dewan Perwak...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/dampak-corona-penumpang-p...</td>\n",
       "      <td>Dampak Corona, Penumpang Pesawat ke Luar Neger...</td>\n",
       "      <td>Iin Nurfahraeni</td>\n",
       "      <td>April 2, 2020 2:16 pm</td>\n",
       "      <td>INIPASTI.COM, JAKARTA – Badan Pusat Statistik ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/cegah-penyebaran-covid-19...</td>\n",
       "      <td>Cegah Penyebaran Covid-19, WNA Mulai Dilarang ...</td>\n",
       "      <td>Iin Nurfahraeni</td>\n",
       "      <td>April 2, 2020 2:15 pm</td>\n",
       "      <td>INIPASTI.COM, JAKARTA – Penyebaran virus Coron...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/as-dan-inggris-ingatkan-a...</td>\n",
       "      <td>AS dan Inggris Ingatkan, Adanya Peretas Dukung...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 6, 2020 9:18 am</td>\n",
       "      <td>INIPASTI.COM, LONDON / WASHINGTON – Peretas ya...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/jelang-lebaran-di-tengah-...</td>\n",
       "      <td>Jelang Lebaran di Tengah Pandemi, Muda Mudi To...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 7, 2020 9:50 am</td>\n",
       "      <td>INIPASTI.COM, MALILI – Melihat pandemi yang su...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/jelang-lebaran-di-tengah-...</td>\n",
       "      <td>Jelang Lebaran di Tengah Pandemi, Muda Mudi To...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 7, 2020 9:50 am</td>\n",
       "      <td>INIPASTI.COM, MALILI – Melihat pandemi yang su...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/iqbal-suhaeb-psbb-tahap-k...</td>\n",
       "      <td>Iqbal Suhaeb: PSBB Tahap Kedua untuk Bangun So...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 6, 2020 5:38 pm</td>\n",
       "      <td>INIPASTI.COM, MAKASSAR – Pj Wali Kota Makassar...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/iqbal-suhaeb-psbb-tahap-k...</td>\n",
       "      <td>Iqbal Suhaeb: PSBB Tahap Kedua untuk Bangun So...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 6, 2020 5:38 pm</td>\n",
       "      <td>INIPASTI.COM, MAKASSAR – Pj Wali Kota Makassar...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/perangi-berita-palsu-fron...</td>\n",
       "      <td>Perangi Berita Palsu: Front Baru dalam Melawan...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>April 14, 2020 8:07 am</td>\n",
       "      <td>INIPASTI.COM, ANALISIS – Jaman yang disesaki d...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/fakta-baru-virus-corona-y...</td>\n",
       "      <td>Fakta Baru Virus Corona yang Mengejutkan</td>\n",
       "      <td>Syakhruddin DN</td>\n",
       "      <td>Februari 8, 2020 11:50 am</td>\n",
       "      <td>INIPASTI.COM, JAKARTA –  Satu pasien, dirawat ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/opini-covid-19-mengubah-l...</td>\n",
       "      <td>[Opini] Covid-19 Mengubah Lanskap Persekolahan...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 5, 2020 9:28 am</td>\n",
       "      <td>Dr. Naidah Naing, ST., MSi., IAI INIPASTI.COM,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/kenapa-ribut-dengan-satga...</td>\n",
       "      <td>Kenapa Ribut dengan Satgas COVID dan Ramuan HE...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 4, 2020 11:40 am</td>\n",
       "      <td>Oleh: Haris Rusly Moti INIPASTI.COM, OPINI – S...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/coronavirus-disease-centr...</td>\n",
       "      <td>“Coronavirus Disease Centre” Pemprov Sulsel</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 2, 2020 8:02 am</td>\n",
       "      <td>Penulis : Muhammad Zaiyani INIPASTI.COM, OPINI...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/ajak-masyarakat-cegah-cor...</td>\n",
       "      <td>Ajak Masyarakat Cegah Corona, Appi Tetap Optim...</td>\n",
       "      <td>Muhammad Seilessy</td>\n",
       "      <td>April 30, 2020 5:30 pm</td>\n",
       "      <td>INIPASTI.COM, MAKASSAR — Bakal calon Wali Kota...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/bagaimana-coronavirus-dap...</td>\n",
       "      <td>Bagaimana Coronavirus Dapat Mengubah Tatanan I...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Maret 21, 2020 10:31 pm</td>\n",
       "      <td>INIPASTI.COM – Wabah coronavirus COVID-19 tela...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/gratis-di-tengah-pandemi-...</td>\n",
       "      <td>Gratis di Tengah Pandemi, Anda Sekarang Dapat ...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 2, 2020 7:44 am</td>\n",
       "      <td>INIPASTI.COM, TIPS – Google memotong harga apl...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/para-pengajarnya-selebrit...</td>\n",
       "      <td>Para Pengajarnya Selebritis, Startup Kelas Onl...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 5, 2020 9:08 am</td>\n",
       "      <td>INIPASTI.COM, MasterClass, sebuah startup yang...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/pasien-eks-covid-19-dikun...</td>\n",
       "      <td>Pasien Eks Covid-19 dikunjungi Tim Gugus Tugas...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 5, 2020 2:19 pm</td>\n",
       "      <td>INIPASTI.COM, PASANGKAYU– Satu pasien Covid-19...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/terkait-rencana-psbb-di-s...</td>\n",
       "      <td>Terkait Rencana PSBB di Sulbar,Ini Masukan Pem...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 4, 2020 4:54 am</td>\n",
       "      <td>INIPASTI.COM, PASANGKAYU – Pemprov Sulbar ikut...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/kunjungi-posko-covid-19-w...</td>\n",
       "      <td>Kunjungi Posko Covid 19, Wagub Sulsel Beri Apr...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 6, 2020 12:13 pm</td>\n",
       "      <td>INIPASTI.COM, MAKASSAR, Wakil Gubernur Sulawes...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/kunjungi-posko-covid-19-w...</td>\n",
       "      <td>Kunjungi Posko Covid 19, Wagub Sulsel Beri Apr...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 6, 2020 12:13 pm</td>\n",
       "      <td>INIPASTI.COM, MAKASSAR, Wakil Gubernur Sulawes...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/menyakitkan-al-aqsa-ditut...</td>\n",
       "      <td>‘Menyakitkan’: Al-Aqsa Ditutup Selama Ramadan ...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>April 17, 2020 2:23 pm</td>\n",
       "      <td>INIPASTI.COM – Dewan Wakaf Islam Yerusalem mem...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/cegah-meluasnya-wabah-cov...</td>\n",
       "      <td>Cegah Meluasnya Wabah Covid-19, Mudik Lebaran ...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Maret 25, 2020 9:19 am</td>\n",
       "      <td>INIPASTI.COM, Jakarta –  Mudik lebaran 2020 ak...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/pbb-dunia-harus-mencontoh...</td>\n",
       "      <td>PBB: Dunia harus Mencontoh Korea Selatan dalam...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>Mei 1, 2020 2:10 pm</td>\n",
       "      <td>INIPASTI.COM, Ketua PBB mengatakan bahwasanya ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/hasil-uji-coba-remdesivir...</td>\n",
       "      <td>Ini Obat Covid-19 Paling Berhasil yang Diuji C...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>April 30, 2020 2:11 pm</td>\n",
       "      <td>INIPASTI.COM, Harapan akan terapi obat yang ef...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>Inipasti.com</td>\n",
       "      <td>https://inipasti.com/5-hal-berpenghasilan-yang...</td>\n",
       "      <td>5 Hal Berpenghasilan yang Dapat Anda Pelajari ...</td>\n",
       "      <td>Inipasti</td>\n",
       "      <td>April 21, 2020 7:57 am</td>\n",
       "      <td>INIPASTI.COM, TIPS – Perintah karantina atau k...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            news                                               link  \\\n",
       "0   Inipasti.com  https://inipasti.com/category/kesehatan/corona...   \n",
       "1   Inipasti.com  https://inipasti.com/dalam-bayang-bayang-coron...   \n",
       "2   Inipasti.com  https://inipasti.com/trump-menjanjikan-vaksin-...   \n",
       "3   Inipasti.com  https://inipasti.com/partai-gelora-bagi-bantua...   \n",
       "4   Inipasti.com  https://inipasti.com/para-pengajarnya-selebrit...   \n",
       "5   Inipasti.com  https://inipasti.com/tanggap-pandemi-satgas-co...   \n",
       "6   Inipasti.com  https://inipasti.com/pasien-eks-covid-19-dikun...   \n",
       "7   Inipasti.com  https://inipasti.com/terkait-rencana-psbb-di-s...   \n",
       "8   Inipasti.com  https://inipasti.com/psbb-makassar-diperpanjan...   \n",
       "9   Inipasti.com  https://inipasti.com/ajiep-surati-pimpinan-dpd...   \n",
       "10  Inipasti.com  https://inipasti.com/dampak-corona-penumpang-p...   \n",
       "11  Inipasti.com  https://inipasti.com/cegah-penyebaran-covid-19...   \n",
       "12  Inipasti.com  https://inipasti.com/as-dan-inggris-ingatkan-a...   \n",
       "13  Inipasti.com  https://inipasti.com/jelang-lebaran-di-tengah-...   \n",
       "14  Inipasti.com  https://inipasti.com/jelang-lebaran-di-tengah-...   \n",
       "15  Inipasti.com  https://inipasti.com/iqbal-suhaeb-psbb-tahap-k...   \n",
       "16  Inipasti.com  https://inipasti.com/iqbal-suhaeb-psbb-tahap-k...   \n",
       "17  Inipasti.com  https://inipasti.com/perangi-berita-palsu-fron...   \n",
       "18  Inipasti.com  https://inipasti.com/fakta-baru-virus-corona-y...   \n",
       "19  Inipasti.com  https://inipasti.com/opini-covid-19-mengubah-l...   \n",
       "20  Inipasti.com  https://inipasti.com/kenapa-ribut-dengan-satga...   \n",
       "21  Inipasti.com  https://inipasti.com/coronavirus-disease-centr...   \n",
       "22  Inipasti.com  https://inipasti.com/ajak-masyarakat-cegah-cor...   \n",
       "23  Inipasti.com  https://inipasti.com/bagaimana-coronavirus-dap...   \n",
       "24  Inipasti.com  https://inipasti.com/gratis-di-tengah-pandemi-...   \n",
       "25  Inipasti.com  https://inipasti.com/para-pengajarnya-selebrit...   \n",
       "26  Inipasti.com  https://inipasti.com/pasien-eks-covid-19-dikun...   \n",
       "27  Inipasti.com  https://inipasti.com/terkait-rencana-psbb-di-s...   \n",
       "28  Inipasti.com  https://inipasti.com/kunjungi-posko-covid-19-w...   \n",
       "29  Inipasti.com  https://inipasti.com/kunjungi-posko-covid-19-w...   \n",
       "30  Inipasti.com  https://inipasti.com/menyakitkan-al-aqsa-ditut...   \n",
       "31  Inipasti.com  https://inipasti.com/cegah-meluasnya-wabah-cov...   \n",
       "32  Inipasti.com  https://inipasti.com/pbb-dunia-harus-mencontoh...   \n",
       "33  Inipasti.com  https://inipasti.com/hasil-uji-coba-remdesivir...   \n",
       "34  Inipasti.com  https://inipasti.com/5-hal-berpenghasilan-yang...   \n",
       "\n",
       "                                                title             author  \\\n",
       "0                                         Coronavirus               None   \n",
       "1   Dalam Bayang-bayang Coronavirus, Umat Islam di...           Inipasti   \n",
       "2   Trump Menjanjikan Vaksin Covid-19 pada Akhir T...           Inipasti   \n",
       "3   Partai Gelora Bagi Bantuan Sembako ke Warga Te...  Muhammad Seilessy   \n",
       "4   Para Pengajarnya Selebritis, Startup Kelas Onl...           Inipasti   \n",
       "5   Tanggap Pandemi, Satgas Covid-19 Unhas Terima ...           Inipasti   \n",
       "6   Pasien Eks Covid-19 dikunjungi Tim Gugus Tugas...           Inipasti   \n",
       "7   Terkait Rencana PSBB di Sulbar,Ini Masukan Pem...           Inipasti   \n",
       "8   PSBB Makassar Diperpanjang 14 Hari, Petugas Di...  Muhammad Seilessy   \n",
       "9   Ajiep Surati Pimpinan DPD Terkait Postur APBN ...  Muhammad Seilessy   \n",
       "10  Dampak Corona, Penumpang Pesawat ke Luar Neger...    Iin Nurfahraeni   \n",
       "11  Cegah Penyebaran Covid-19, WNA Mulai Dilarang ...    Iin Nurfahraeni   \n",
       "12  AS dan Inggris Ingatkan, Adanya Peretas Dukung...           Inipasti   \n",
       "13  Jelang Lebaran di Tengah Pandemi, Muda Mudi To...           Inipasti   \n",
       "14  Jelang Lebaran di Tengah Pandemi, Muda Mudi To...           Inipasti   \n",
       "15  Iqbal Suhaeb: PSBB Tahap Kedua untuk Bangun So...           Inipasti   \n",
       "16  Iqbal Suhaeb: PSBB Tahap Kedua untuk Bangun So...           Inipasti   \n",
       "17  Perangi Berita Palsu: Front Baru dalam Melawan...           Inipasti   \n",
       "18           Fakta Baru Virus Corona yang Mengejutkan     Syakhruddin DN   \n",
       "19  [Opini] Covid-19 Mengubah Lanskap Persekolahan...           Inipasti   \n",
       "20  Kenapa Ribut dengan Satgas COVID dan Ramuan HE...           Inipasti   \n",
       "21        “Coronavirus Disease Centre” Pemprov Sulsel           Inipasti   \n",
       "22  Ajak Masyarakat Cegah Corona, Appi Tetap Optim...  Muhammad Seilessy   \n",
       "23  Bagaimana Coronavirus Dapat Mengubah Tatanan I...           Inipasti   \n",
       "24  Gratis di Tengah Pandemi, Anda Sekarang Dapat ...           Inipasti   \n",
       "25  Para Pengajarnya Selebritis, Startup Kelas Onl...           Inipasti   \n",
       "26  Pasien Eks Covid-19 dikunjungi Tim Gugus Tugas...           Inipasti   \n",
       "27  Terkait Rencana PSBB di Sulbar,Ini Masukan Pem...           Inipasti   \n",
       "28  Kunjungi Posko Covid 19, Wagub Sulsel Beri Apr...           Inipasti   \n",
       "29  Kunjungi Posko Covid 19, Wagub Sulsel Beri Apr...           Inipasti   \n",
       "30  ‘Menyakitkan’: Al-Aqsa Ditutup Selama Ramadan ...           Inipasti   \n",
       "31  Cegah Meluasnya Wabah Covid-19, Mudik Lebaran ...           Inipasti   \n",
       "32  PBB: Dunia harus Mencontoh Korea Selatan dalam...           Inipasti   \n",
       "33  Ini Obat Covid-19 Paling Berhasil yang Diuji C...           Inipasti   \n",
       "34  5 Hal Berpenghasilan yang Dapat Anda Pelajari ...           Inipasti   \n",
       "\n",
       "                    date_time  \\\n",
       "0         Mei 1, 2020 2:10 pm   \n",
       "1     April 21, 2020 10:37 am   \n",
       "2        Mei 4, 2020 10:52 am   \n",
       "3         Mei 3, 2020 5:48 pm   \n",
       "4         Mei 5, 2020 9:08 am   \n",
       "5      April 23, 2020 5:50 pm   \n",
       "6         Mei 5, 2020 2:19 pm   \n",
       "7         Mei 4, 2020 4:54 am   \n",
       "8         Mei 6, 2020 5:08 pm   \n",
       "9      April 10, 2020 2:03 pm   \n",
       "10      April 2, 2020 2:16 pm   \n",
       "11      April 2, 2020 2:15 pm   \n",
       "12        Mei 6, 2020 9:18 am   \n",
       "13        Mei 7, 2020 9:50 am   \n",
       "14        Mei 7, 2020 9:50 am   \n",
       "15        Mei 6, 2020 5:38 pm   \n",
       "16        Mei 6, 2020 5:38 pm   \n",
       "17     April 14, 2020 8:07 am   \n",
       "18  Februari 8, 2020 11:50 am   \n",
       "19        Mei 5, 2020 9:28 am   \n",
       "20       Mei 4, 2020 11:40 am   \n",
       "21        Mei 2, 2020 8:02 am   \n",
       "22     April 30, 2020 5:30 pm   \n",
       "23    Maret 21, 2020 10:31 pm   \n",
       "24        Mei 2, 2020 7:44 am   \n",
       "25        Mei 5, 2020 9:08 am   \n",
       "26        Mei 5, 2020 2:19 pm   \n",
       "27        Mei 4, 2020 4:54 am   \n",
       "28       Mei 6, 2020 12:13 pm   \n",
       "29       Mei 6, 2020 12:13 pm   \n",
       "30     April 17, 2020 2:23 pm   \n",
       "31     Maret 25, 2020 9:19 am   \n",
       "32        Mei 1, 2020 2:10 pm   \n",
       "33     April 30, 2020 2:11 pm   \n",
       "34     April 21, 2020 7:57 am   \n",
       "\n",
       "                                             paragraf  \n",
       "0                                             N o n e  \n",
       "1   INIPASTI.COM, ALGIERS / CAIRO / JAKARTA – Bebe...  \n",
       "2   INIPASTI.COM, Presiden Donald Trump meluncurka...  \n",
       "3   INIPASTI.COM, MAKASSAR, – DPD Partai Gelora In...  \n",
       "4   INIPASTI.COM, MasterClass, sebuah startup yang...  \n",
       "5   INIPASTI.COM, MAKASSAR – Satuan Tugas Pencegah...  \n",
       "6   INIPASTI.COM, PASANGKAYU– Satu pasien Covid-19...  \n",
       "7   INIPASTI.COM, PASANGKAYU – Pemprov Sulbar ikut...  \n",
       "8   INIPASTI.COM, MAKASSAR, — Pembatasan Sosial Be...  \n",
       "9   INIPASTI.COM, MAKASSAR, — Anggota Dewan Perwak...  \n",
       "10  INIPASTI.COM, JAKARTA – Badan Pusat Statistik ...  \n",
       "11  INIPASTI.COM, JAKARTA – Penyebaran virus Coron...  \n",
       "12  INIPASTI.COM, LONDON / WASHINGTON – Peretas ya...  \n",
       "13  INIPASTI.COM, MALILI – Melihat pandemi yang su...  \n",
       "14  INIPASTI.COM, MALILI – Melihat pandemi yang su...  \n",
       "15  INIPASTI.COM, MAKASSAR – Pj Wali Kota Makassar...  \n",
       "16  INIPASTI.COM, MAKASSAR – Pj Wali Kota Makassar...  \n",
       "17  INIPASTI.COM, ANALISIS – Jaman yang disesaki d...  \n",
       "18  INIPASTI.COM, JAKARTA –  Satu pasien, dirawat ...  \n",
       "19  Dr. Naidah Naing, ST., MSi., IAI INIPASTI.COM,...  \n",
       "20  Oleh: Haris Rusly Moti INIPASTI.COM, OPINI – S...  \n",
       "21  Penulis : Muhammad Zaiyani INIPASTI.COM, OPINI...  \n",
       "22  INIPASTI.COM, MAKASSAR — Bakal calon Wali Kota...  \n",
       "23  INIPASTI.COM – Wabah coronavirus COVID-19 tela...  \n",
       "24  INIPASTI.COM, TIPS – Google memotong harga apl...  \n",
       "25  INIPASTI.COM, MasterClass, sebuah startup yang...  \n",
       "26  INIPASTI.COM, PASANGKAYU– Satu pasien Covid-19...  \n",
       "27  INIPASTI.COM, PASANGKAYU – Pemprov Sulbar ikut...  \n",
       "28  INIPASTI.COM, MAKASSAR, Wakil Gubernur Sulawes...  \n",
       "29  INIPASTI.COM, MAKASSAR, Wakil Gubernur Sulawes...  \n",
       "30  INIPASTI.COM – Dewan Wakaf Islam Yerusalem mem...  \n",
       "31  INIPASTI.COM, Jakarta –  Mudik lebaran 2020 ak...  \n",
       "32  INIPASTI.COM, Ketua PBB mengatakan bahwasanya ...  \n",
       "33  INIPASTI.COM, Harapan akan terapi obat yang ef...  \n",
       "34  INIPASTI.COM, TIPS – Perintah karantina atau k...  "
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# r = get_news(main_url, \"news_2\")\n",
    "# r\n",
    "\n",
    "inipasti_news=get_news(main_url, file_name = 'inipasti_satu')\n",
    "inipasti_news"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "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
}