|
1678 | 1678 | "source": [
|
1679 | 1679 | "[Link to facebook-scraper](https://github.com/kevinzg/facebook-scraper)."
|
1680 | 1680 | ]
|
| 1681 | + }, |
| 1682 | + { |
| 1683 | + "cell_type": "markdown", |
| 1684 | + "id": "2a345801", |
| 1685 | + "metadata": {}, |
| 1686 | + "source": [ |
| 1687 | + "### Recipe-Scrapers: Automate Recipe Data Extraction" |
| 1688 | + ] |
| 1689 | + }, |
| 1690 | + { |
| 1691 | + "cell_type": "code", |
| 1692 | + "execution_count": null, |
| 1693 | + "id": "94590858", |
| 1694 | + "metadata": { |
| 1695 | + "tags": [ |
| 1696 | + "hide-cell" |
| 1697 | + ] |
| 1698 | + }, |
| 1699 | + "outputs": [], |
| 1700 | + "source": [ |
| 1701 | + "!pip install recipe-scrapers" |
| 1702 | + ] |
| 1703 | + }, |
| 1704 | + { |
| 1705 | + "cell_type": "markdown", |
| 1706 | + "id": "1e12bdd4", |
| 1707 | + "metadata": {}, |
| 1708 | + "source": [ |
| 1709 | + "Manually searching for recipes and compiling information can be time-consuming. recipe-scrapers is a Python library that automates this process, quickly extracting data from multiple sources and presenting it in a consolidated format." |
| 1710 | + ] |
| 1711 | + }, |
| 1712 | + { |
| 1713 | + "cell_type": "code", |
| 1714 | + "execution_count": 2, |
| 1715 | + "id": "b7d3ee8d", |
| 1716 | + "metadata": {}, |
| 1717 | + "outputs": [ |
| 1718 | + { |
| 1719 | + "data": { |
| 1720 | + "text/plain": [ |
| 1721 | + "'cookieandkate.com'" |
| 1722 | + ] |
| 1723 | + }, |
| 1724 | + "execution_count": 2, |
| 1725 | + "metadata": {}, |
| 1726 | + "output_type": "execute_result" |
| 1727 | + } |
| 1728 | + ], |
| 1729 | + "source": [ |
| 1730 | + "from recipe_scrapers import scrape_me\n", |
| 1731 | + "\n", |
| 1732 | + "scraper = scrape_me('https://cookieandkate.com/thai-red-curry-recipe/')\n", |
| 1733 | + "\n", |
| 1734 | + "scraper.host()\n" |
| 1735 | + ] |
| 1736 | + }, |
| 1737 | + { |
| 1738 | + "cell_type": "code", |
| 1739 | + "execution_count": 3, |
| 1740 | + "id": "ef9fbd45", |
| 1741 | + "metadata": {}, |
| 1742 | + "outputs": [ |
| 1743 | + { |
| 1744 | + "data": { |
| 1745 | + "text/plain": [ |
| 1746 | + "'Thai Red Curry with Vegetables'" |
| 1747 | + ] |
| 1748 | + }, |
| 1749 | + "execution_count": 3, |
| 1750 | + "metadata": {}, |
| 1751 | + "output_type": "execute_result" |
| 1752 | + } |
| 1753 | + ], |
| 1754 | + "source": [ |
| 1755 | + "scraper.title()\n" |
| 1756 | + ] |
| 1757 | + }, |
| 1758 | + { |
| 1759 | + "cell_type": "code", |
| 1760 | + "execution_count": 4, |
| 1761 | + "id": "1e6f1760", |
| 1762 | + "metadata": {}, |
| 1763 | + "outputs": [ |
| 1764 | + { |
| 1765 | + "data": { |
| 1766 | + "text/plain": [ |
| 1767 | + "40" |
| 1768 | + ] |
| 1769 | + }, |
| 1770 | + "execution_count": 4, |
| 1771 | + "metadata": {}, |
| 1772 | + "output_type": "execute_result" |
| 1773 | + } |
| 1774 | + ], |
| 1775 | + "source": [ |
| 1776 | + "scraper.total_time()\n" |
| 1777 | + ] |
| 1778 | + }, |
| 1779 | + { |
| 1780 | + "cell_type": "code", |
| 1781 | + "execution_count": 5, |
| 1782 | + "id": "f9dafc6a", |
| 1783 | + "metadata": {}, |
| 1784 | + "outputs": [ |
| 1785 | + { |
| 1786 | + "data": { |
| 1787 | + "text/plain": [ |
| 1788 | + "['1 ¼ cups brown jasmine rice or long-grain brown rice, rinsed',\n", |
| 1789 | + " '1 tablespoon coconut oil or olive oil',\n", |
| 1790 | + " '1 small white onion, chopped (about 1 cup)',\n", |
| 1791 | + " 'Pinch of salt, more to taste',\n", |
| 1792 | + " '1 tablespoon finely grated fresh ginger (about a 1-inch nub of ginger)',\n", |
| 1793 | + " '2 cloves garlic, pressed or minced',\n", |
| 1794 | + " '1 red bell pepper, sliced into thin 2-inch long strips',\n", |
| 1795 | + " '1 yellow, orange or green bell pepper, sliced into thin 2-inch long strips',\n", |
| 1796 | + " '3 carrots, peeled and sliced on the diagonal into ¼-inch thick rounds (about 1 cup)',\n", |
| 1797 | + " '2 tablespoons Thai red curry paste*',\n", |
| 1798 | + " '1 can (14 ounces) regular coconut milk**',\n", |
| 1799 | + " '1/2 cup water',\n", |
| 1800 | + " '1 1/2 cups packed thinly sliced kale (tough ribs removed first), preferably the Tuscan/lacinato/dinosaur variety',\n", |
| 1801 | + " '1 1/2 teaspoons coconut sugar or turbinado (raw) sugar or brown sugar',\n", |
| 1802 | + " '1 tablespoon tamari or soy sauce***',\n", |
| 1803 | + " '2 teaspoons rice vinegar or fresh lime juice',\n", |
| 1804 | + " 'Garnishes/sides: handful of chopped fresh basil or cilantro, optional red pepper flakes, optional sriracha or chili garlic sauce']" |
| 1805 | + ] |
| 1806 | + }, |
| 1807 | + "execution_count": 5, |
| 1808 | + "metadata": {}, |
| 1809 | + "output_type": "execute_result" |
| 1810 | + } |
| 1811 | + ], |
| 1812 | + "source": [ |
| 1813 | + "scraper.ingredients()\n" |
| 1814 | + ] |
| 1815 | + }, |
| 1816 | + { |
| 1817 | + "cell_type": "code", |
| 1818 | + "execution_count": 6, |
| 1819 | + "id": "cd1fa5e1", |
| 1820 | + "metadata": {}, |
| 1821 | + "outputs": [ |
| 1822 | + { |
| 1823 | + "data": { |
| 1824 | + "text/plain": [ |
| 1825 | + "'To cook the rice, bring a large pot of water to boil. Add the rinsed rice and continue boiling for 30 minutes, reducing heat as necessary to prevent overflow. Remove from heat, drain the rice and return the rice to pot. Cover and let the rice rest for 10 minutes or longer, until you’re ready to serve. Just before serving, season the rice to taste with salt and fluff it with a fork.\\nTo make the curry, warm a large skillet with deep sides over medium heat. Once it’s hot, add the oil. Add the onion and a sprinkle of salt and cook, stirring often, until the onion has softened and is turning translucent, about 5 minutes. Add the ginger and garlic and cook until fragrant, about 30 seconds, while stirring continuously.\\nAdd the bell peppers and carrots. Cook until the bell peppers are fork-tender, 3 to 5 more minutes, stirring occasionally. Then add the curry paste and cook, stirring often, for 2 minutes.\\nAdd the coconut milk, water, kale and sugar, and stir to combine. Bring the mixture to a simmer over medium heat. Reduce heat as necessary to maintain a gentle simmer and cook until the peppers, carrots and kale have softened to your liking, about 5 to 10 minutes, stirring occasionally.\\nRemove the pot from the heat and season with tamari and rice vinegar. Add salt (I added 1/4 teaspoon for optimal flavor), to taste. If the curry needs a little more punch, add 1/2 teaspoon more tamari, or for more acidity, add 1/2 teaspoon more rice vinegar. Divide rice and curry into bowls and garnish with chopped cilantro and a sprinkle of red pepper flakes, if you’d like. If you love spicy curries, serve with sriracha or chili garlic sauce on the side.'" |
| 1826 | + ] |
| 1827 | + }, |
| 1828 | + "execution_count": 6, |
| 1829 | + "metadata": {}, |
| 1830 | + "output_type": "execute_result" |
| 1831 | + } |
| 1832 | + ], |
| 1833 | + "source": [ |
| 1834 | + "scraper.instructions()\n" |
| 1835 | + ] |
| 1836 | + }, |
| 1837 | + { |
| 1838 | + "cell_type": "code", |
| 1839 | + "execution_count": 8, |
| 1840 | + "id": "317663e7", |
| 1841 | + "metadata": {}, |
| 1842 | + "outputs": [ |
| 1843 | + { |
| 1844 | + "data": { |
| 1845 | + "text/plain": [ |
| 1846 | + "{'calories': '340 calories',\n", |
| 1847 | + " 'sugarContent': '9.3 g',\n", |
| 1848 | + " 'sodiumContent': '473.3 mg',\n", |
| 1849 | + " 'fatContent': '11.3 g',\n", |
| 1850 | + " 'saturatedFatContent': '8 g',\n", |
| 1851 | + " 'transFatContent': '0 g',\n", |
| 1852 | + " 'carbohydrateContent': '56.3 g',\n", |
| 1853 | + " 'fiberContent': '5.6 g',\n", |
| 1854 | + " 'proteinContent': '8.3 g',\n", |
| 1855 | + " 'cholesterolContent': '0 mg'}" |
| 1856 | + ] |
| 1857 | + }, |
| 1858 | + "execution_count": 8, |
| 1859 | + "metadata": {}, |
| 1860 | + "output_type": "execute_result" |
| 1861 | + } |
| 1862 | + ], |
| 1863 | + "source": [ |
| 1864 | + "scraper.nutrients()" |
| 1865 | + ] |
| 1866 | + }, |
| 1867 | + { |
| 1868 | + "cell_type": "markdown", |
| 1869 | + "id": "7b4be421", |
| 1870 | + "metadata": {}, |
| 1871 | + "source": [ |
| 1872 | + "[Link to recipe-scrapers](https://bit.ly/3U6vw0w)." |
| 1873 | + ] |
1681 | 1874 | }
|
1682 | 1875 | ],
|
1683 | 1876 | "metadata": {
|
|
1698 | 1891 | "name": "python",
|
1699 | 1892 | "nbconvert_exporter": "python",
|
1700 | 1893 | "pygments_lexer": "ipython3",
|
1701 |
| - "version": "3.9.6" |
| 1894 | + "version": "3.11.6" |
1702 | 1895 | },
|
1703 | 1896 | "toc": {
|
1704 | 1897 | "base_numbering": 1,
|
|
0 commit comments