{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "import bs4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [],
   "source": [
    "req=requests.get(\"https://www.tajik-gateway.org/wp/zaboni-tojiki/\")\n",
    "soup=bs4.BeautifulSoup(req.content,\"lxml\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [],
   "source": [
    "urllist=[elem[\"href\"] for elem in soup.find_all(\"a\")[75:-7]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [],
   "source": [
    "cumultext=[]\n",
    "for url in urllist:\n",
    "    req=requests.get(url)\n",
    "    soup=bs4.BeautifulSoup(req.content,\"lxml\")\n",
    "    cumultext=cumultext+[child for child in soup.find_all(\"div\",\"su-note-inner\")[0]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(\"tajik-sng.txt\",\"w\") as fout:\n",
    "    fout.write(\"\".join([str(elem) for elem in cumultext]))"
   ]
  },
  {
   "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.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
