Web
Init file.
AgentQLWebReader #
Bases: BasePydanticReader
Scrape a URL with or without a agentql query and returns document in json format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str
|
The AgentQL API key, get one at https://dev.agentql.com |
required |
params
|
dict
|
Additional parameters to pass to the AgentQL API. Visit https://docs.agentql.com/rest-api/api-reference for details. |
None
|
Source code in llama_index/readers/web/agentql_web/base.py
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 | |
load_data #
load_data(url: str, query: Optional[str] = None, prompt: Optional[str] = None) -> List[Document]
Load data from the input directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
URL to scrape or crawl. |
required |
query
|
Optional[str]
|
AgentQL query used to specify the scraped data. |
None
|
prompt
|
Optional[str]
|
Natural language description of the data you want to scrape. |
None
|
params
|
Optional[dict]
|
Additional parameters to pass to the AgentQL API. Visit https://docs.agentql.com/rest-api/api-reference for details. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: List of documents. |
Source code in llama_index/readers/web/agentql_web/base.py
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 | |
AsyncWebPageReader #
Bases: BaseReader
Asynchronous web page reader.
Reads pages from the web asynchronously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
html_to_text
|
bool
|
Whether to convert HTML to text.
Requires |
False
|
limit
|
int
|
Maximum number of concurrent requests. |
10
|
dedupe
|
bool
|
to deduplicate urls if there is exact-match within given list |
True
|
fail_on_error
|
bool
|
if requested url does not return status code 200 the routine will raise an ValueError |
False
|
Source code in llama_index/readers/web/async_web/base.py
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 | |
aload_data
async
#
aload_data(urls: List[str]) -> List[Document]
Load data from the input urls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urls
|
List[str]
|
List of URLs to scrape. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: List of documents. |
Source code in llama_index/readers/web/async_web/base.py
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 | |
load_data #
load_data(urls: List[str]) -> List[Document]
Load data from the input urls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urls
|
List[str]
|
List of URLs to scrape. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: List of documents. |
Source code in llama_index/readers/web/async_web/base.py
129 130 131 132 133 134 135 136 137 138 139 140 | |
BeautifulSoupWebReader #
Bases: BasePydanticReader
BeautifulSoup web page reader.
Reads pages from the web.
Requires the bs4 and urllib packages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
website_extractor
|
Optional[Dict[str, Callable]]
|
A mapping of website hostname (e.g. google.com) to a function that specifies how to extract text from the BeautifulSoup obj. See DEFAULT_WEBSITE_EXTRACTOR. |
None
|
Source code in llama_index/readers/web/beautiful_soup_web/base.py
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 | |
class_name
classmethod
#
class_name() -> str
Get the name identifier of the class.
Source code in llama_index/readers/web/beautiful_soup_web/base.py
157 158 159 160 | |
load_data #
load_data(urls: List[str], custom_hostname: Optional[str] = None, include_url_in_text: Optional[bool] = True) -> List[Document]
Load data from the urls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urls
|
List[str]
|
List of URLs to scrape. |
required |
custom_hostname
|
Optional[str]
|
Force a certain hostname in the case a website is displayed under custom URLs (e.g. Substack blogs) |
None
|
include_url_in_text
|
Optional[bool]
|
Include the reference url in the text of the document |
True
|
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: List of documents. |
Source code in llama_index/readers/web/beautiful_soup_web/base.py
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 | |
BrowserbaseWebReader #
Bases: BaseReader
BrowserbaseWebReader.
Load pre-rendered web pages using a headless browser hosted on Browserbase.
Depends on browserbase package.
Get your API key from https://browserbase.com
Source code in llama_index/readers/web/browserbase_web/base.py
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 | |
lazy_load_data #
lazy_load_data(urls: Sequence[str], text_content: bool = False, session_id: Optional[str] = None, proxy: Optional[bool] = None) -> Iterator[Document]
Load pages from URLs.
Source code in llama_index/readers/web/browserbase_web/base.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
FireCrawlWebReader #
Bases: BasePydanticReader
turn a url to llm accessible markdown with Firecrawl.dev.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str
|
The Firecrawl API key. |
required |
api_url
|
Optional[str]
|
Optional base URL for Firecrawl deployment |
None
|
mode
|
Optional[str]
|
The mode to run the loader in. Default is "crawl". Options include "scrape" (single url), "crawl" (all accessible sub pages), "map" (map all accessible sub pages), "search" (search for content), and "extract" (extract structured data from URLs using a prompt). |
'crawl'
|
params
|
Optional[dict]
|
The parameters to pass to the Firecrawl API. |
None
|
Examples include crawlerOptions. For more details, visit: https://docs.firecrawl.dev/sdks/python
Source code in llama_index/readers/web/firecrawl_web/base.py
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 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | |
load_data #
load_data(url: Optional[str] = None, query: Optional[str] = None, urls: Optional[List[str]] = None) -> List[Document]
Load data from the input directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
Optional[str]
|
URL to scrape or crawl. |
None
|
query
|
Optional[str]
|
Query to search for. |
None
|
urls
|
Optional[List[str]]
|
List of URLs for extract mode. |
None
|
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: List of documents. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If invalid combination of parameters is provided. |
Source code in llama_index/readers/web/firecrawl_web/base.py
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 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | |
HyperbrowserWebReader #
Bases: BaseReader
Hyperbrowser Web Reader.
Scrape or crawl web pages with optional parameters for configuring content extraction.
Requires the hyperbrowser package.
Get your API Key from https://app.hyperbrowser.ai/
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
Optional[str]
|
The Hyperbrowser API key, can be set as an environment variable |
None
|
Source code in llama_index/readers/web/hyperbrowser_web/base.py
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 | |
lazy_load_data #
lazy_load_data(urls: List[str], operation: Literal['scrape', 'crawl'] = 'scrape', params: Optional[Dict] = {}) -> Iterable[Document]
Lazy load documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urls
|
List[str]
|
List of URLs to scrape or crawl |
required |
operation
|
Literal['scrape', 'crawl']
|
Operation to perform. Can be "scrape" or "crawl" |
'scrape'
|
params
|
Optional[Dict]
|
Optional params for scrape or crawl. For more information on the supported params, visit https://docs.hyperbrowser.ai/reference/sdks/python/scrape#start-scrape-job-and-wait or https://docs.hyperbrowser.ai/reference/sdks/python/crawl#start-crawl-job-and-wait |
{}
|
Source code in llama_index/readers/web/hyperbrowser_web/base.py
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 | |
alazy_load_data
async
#
alazy_load_data(urls: Sequence[str], operation: Literal['scrape', 'crawl'] = 'scrape', params: Optional[Dict] = {}) -> AsyncIterable[Document]
Async lazy load documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urls
|
Sequence[str]
|
List of URLs to scrape or crawl |
required |
operation
|
Literal['scrape', 'crawl']
|
Operation to perform. Can be "scrape" or "crawl" |
'scrape'
|
params
|
Optional[Dict]
|
Optional params for scrape or crawl. For more information on the supported params, visit https://docs.hyperbrowser.ai/reference/sdks/python/scrape#start-scrape-job-and-wait or https://docs.hyperbrowser.ai/reference/sdks/python/crawl#start-crawl-job-and-wait |
{}
|
Source code in llama_index/readers/web/hyperbrowser_web/base.py
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 | |
KnowledgeBaseWebReader #
Bases: BaseReader
Knowledge base reader.
Crawls and reads articles from a knowledge base/help center with Playwright.
Tested on Zendesk and Intercom CMS, may work on others.
Can be run in headless mode but it may be blocked by Cloudflare. Run it headed to be safe.
Times out occasionally, just increase the default time out if it does.
Requires the playwright package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root_url
|
str
|
the base url of the knowledge base, with no trailing slash e.g. 'https://support.intercom.com' |
required |
link_selectors
|
List[str]
|
list of css selectors to find links to articles while crawling e.g. ['.article-list a', '.article-list a'] |
required |
article_path
|
str
|
the url path of articles on this domain so the crawler knows when to stop e.g. '/articles' |
required |
title_selector
|
Optional[str]
|
css selector to find the title of the article e.g. '.article-title' |
None
|
subtitle_selector
|
Optional[str]
|
css selector to find the subtitle/description of the article e.g. '.article-subtitle' |
None
|
body_selector
|
Optional[str]
|
css selector to find the body of the article e.g. '.article-body' |
None
|
Source code in llama_index/readers/web/knowledge_base/base.py
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 | |
load_data #
load_data() -> List[Document]
Load data from the knowledge base.
Source code in llama_index/readers/web/knowledge_base/base.py
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 | |
scrape_article #
scrape_article(browser: Any, url: str) -> Dict[str, str]
Scrape a single article url.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
browser
|
Any
|
a Playwright Chromium browser. |
required |
url
|
str
|
URL of the article to scrape. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, str]
|
Dict[str, str]: a mapping of article attributes to their values. |
Source code in llama_index/readers/web/knowledge_base/base.py
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 | |
get_article_urls #
get_article_urls(browser: Any, root_url: str, current_url: str, max_depth: int = 100, depth: int = 0) -> List[str]
Recursively crawl through the knowledge base to find a list of articles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
browser
|
Any
|
a Playwright Chromium browser. |
required |
root_url
|
str
|
root URL of the knowledge base. |
required |
current_url
|
str
|
current URL that is being crawled. |
required |
max_depth
|
int
|
maximum recursion level for the crawler |
100
|
depth
|
int
|
current depth level |
0
|
Returns:
| Type | Description |
|---|---|
List[str]
|
List[str]: a list of URLs of found articles. |
Source code in llama_index/readers/web/knowledge_base/base.py
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 | |
MainContentExtractorReader #
Bases: BaseReader
MainContentExtractor web page reader.
Reads pages from the web.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text_format
|
str
|
The format of the text. Defaults to "markdown".
Requires |
'markdown'
|
Source code in llama_index/readers/web/main_content_extractor/base.py
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 | |
load_data #
load_data(urls: List[str]) -> List[Document]
Load data from the input directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urls
|
List[str]
|
List of URLs to scrape. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: List of documents. |
Source code in llama_index/readers/web/main_content_extractor/base.py
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 | |
NewsArticleReader #
Bases: BaseReader
Simple news article reader.
Reads news articles from the web and parses them using the newspaper library.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text_mode
|
bool
|
Whether to load a text version or HTML version of the content (default=True). |
True
|
use_nlp
|
bool
|
Whether to use NLP to extract additional summary and keywords (default=True). |
True
|
newspaper_kwargs
|
Any
|
Additional keyword arguments to pass to newspaper.Article. See https://newspaper.readthedocs.io/en/latest/user_guide/quickstart.html#article |
{}
|
Source code in llama_index/readers/web/news/base.py
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 | |
load_data #
load_data(urls: List[str]) -> List[Document]
Load data from the list of news article urls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urls
|
List[str]
|
List of URLs to load news articles. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: List of documents. |
Source code in llama_index/readers/web/news/base.py
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 | |
OxylabsWebReader #
Bases: BasePydanticReader
Scrape any website with Oxylabs Web Scraper API and get results in Markdown format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username
|
str
|
Oxylabs API username. |
required |
password
|
str
|
Oxylabs API password. |
required |
Example
.. code-block:: python from llama_index.readers.web.oxylabs_web.base import OxylabsWebReader
reader = OxylabsWebReader(
username=os.environ["OXYLABS_USERNAME"], password=os.environ["OXYLABS_PASSWORD"]
)
docs = reader.load_data(
[
"https://sandbox.oxylabs.io/products/1",
"https://sandbox.oxylabs.io/products/2"
],
{
"parse": True,
}
)
print(docs[0].text)
Source code in llama_index/readers/web/oxylabs_web/base.py
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 | |
aload_data
async
#
aload_data(urls: list[str], additional_params: Optional[Dict[str, Any]] = None) -> List[Document]
Asynchronously load data from urls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urls
|
list[str]
|
List of URLs to load. |
required |
additional_params
|
Optional[Dict[str, Any]]
|
Dictionary of scraper parameters as described here |
None
|
Source code in llama_index/readers/web/oxylabs_web/base.py
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 | |
load_data #
load_data(urls: list[str], additional_params: Optional[Dict[str, Any]] = None) -> List[Document]
Load data from urls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urls
|
list[str]
|
List of URLs to load. |
required |
additional_params
|
Optional[Dict[str, Any]]
|
Dictionary of scraper parameters as described here |
None
|
Source code in llama_index/readers/web/oxylabs_web/base.py
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 | |
ReadabilityWebPageReader #
Bases: BaseReader
Readability Webpage Loader.
Extracting relevant information from a fully rendered web page. During the processing, it is always assumed that web pages used as data sources contain textual content.
- Load the page and wait for it rendered. (playwright)
- Inject Readability.js to extract the main content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
proxy
|
Optional[str]
|
Proxy server. Defaults to None. |
None
|
wait_until
|
Optional[Literal['commit', 'domcontentloaded', 'load', 'networkidle']]
|
Wait until the page is loaded. Defaults to "domcontentloaded". |
'domcontentloaded'
|
text_splitter
|
TextSplitter
|
Text splitter. Defaults to None. |
None
|
normalizer
|
Optional[Callable[[str], str]]
|
Text normalizer. Defaults to nfkc_normalize. |
required |
Source code in llama_index/readers/web/readability_web/base.py
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 | |
async_load_data
async
#
async_load_data(url: str) -> List[Document]
Render and load data content from url.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
URL to scrape. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: List of documents. |
Source code in llama_index/readers/web/readability_web/base.py
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 | |
scrape_page
async
#
scrape_page(browser: Browser, url: str) -> Dict[str, str]
Scrape a single article url.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
browser
|
Any
|
a Playwright Chromium browser. |
required |
url
|
str
|
URL of the article to scrape. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Ref |
Dict[str, str]
|
https://github.com/mozilla/readability |
title |
Dict[str, str]
|
article title; |
content |
Dict[str, str]
|
HTML string of processed article content; |
textContent |
Dict[str, str]
|
text content of the article, with all the HTML tags removed; |
length |
Dict[str, str]
|
length of an article, in characters; |
excerpt |
Dict[str, str]
|
article description, or short excerpt from the content; |
byline |
Dict[str, str]
|
author metadata; |
dir |
Dict[str, str]
|
content direction; |
siteName |
Dict[str, str]
|
name of the site. |
lang |
Dict[str, str]
|
content language |
Source code in llama_index/readers/web/readability_web/base.py
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 | |
RssReader #
Bases: BasePydanticReader
RSS reader.
Reads content from an RSS feed.
Source code in llama_index/readers/web/rss/base.py
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 | |
load_data #
load_data(urls: List[str]) -> List[Document]
Load data from RSS feeds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urls
|
List[str]
|
List of RSS URLs to load. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: List of documents. |
Source code in llama_index/readers/web/rss/base.py
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 | |
RssNewsReader #
Bases: BaseReader
RSS news reader.
Reads news content from RSS feeds and parses with NewsArticleReader.
Source code in llama_index/readers/web/rss_news/base.py
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 | |
load_data #
load_data(urls: List[str] = None, opml: str = None) -> List[Document]
Load data from either RSS feeds or OPML.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urls
|
List[str]
|
List of RSS URLs to load. |
None
|
opml
|
str
|
URL to OPML file or string or byte OPML content. |
None
|
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: List of documents. |
Source code in llama_index/readers/web/rss_news/base.py
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 | |
ScrapflyReader #
Bases: BasePydanticReader
Turn a url to llm accessible markdown with Scrapfly.io.
Args: api_key: The Scrapfly API key. scrape_config: The Scrapfly ScrapeConfig object. ignore_scrape_failures: Whether to continue on failures. urls: List of urls to scrape. scrape_format: Scrape result format (markdown or text) For further details, visit: https://scrapfly.io/docs/sdk/python
Source code in llama_index/readers/web/scrapfly_web/base.py
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 | |
load_data #
load_data(urls: List[str], scrape_format: Literal['markdown', 'text'] = 'markdown', scrape_config: Optional[dict] = None) -> List[Document]
Load data from the urls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urls
|
List[str]
|
List[str]): List of URLs to scrape. |
required |
scrape_config
|
Optional[dict]
|
Optional[dict]: Dictionary of ScrapFly scrape config object. |
None
|
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: List of documents. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If URLs aren't provided. |
Source code in llama_index/readers/web/scrapfly_web/base.py
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 | |
SimpleWebPageReader #
Bases: BasePydanticReader
Simple web page reader.
Reads pages from the web.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
html_to_text
|
bool
|
Whether to convert HTML to text.
Requires |
False
|
metadata_fn
|
Optional[Callable[[str], Dict]]
|
A function that takes in a URL and returns a dictionary of metadata. Default is None. |
None
|
Source code in llama_index/readers/web/simple_web/base.py
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 | |
load_data #
load_data(urls: List[str]) -> List[Document]
Load data from the input directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urls
|
List[str]
|
List of URLs to scrape. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: List of documents. |
Source code in llama_index/readers/web/simple_web/base.py
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 | |
SitemapReader #
Bases: BaseReader
Asynchronous sitemap reader for web.
Reads pages from the web based on their sitemap.xml.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sitemap_url
|
string
|
Path to the sitemap.xml. e.g. https://gpt-index.readthedocs.io/sitemap.xml |
required |
html_to_text
|
bool
|
Whether to convert HTML to text.
Requires |
False
|
limit
|
int
|
Maximum number of concurrent requests. |
10
|
Source code in llama_index/readers/web/sitemap/base.py
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 | |
SpiderWebReader #
Bases: BasePydanticReader
Scrapes a URL for data and returns llm-ready data with Spider.cloud.
Must have the Python package spider-client installed and a Spider API key.
See https://spider.cloud for more.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str
|
The Spider API key, get one at https://spider.cloud |
None
|
mode
|
Mode
|
"Scrape" the url (default) or "crawl" the url following all subpages. |
'scrape'
|
params
|
dict
|
Additional parameters to pass to the Spider API. |
None
|
Source code in llama_index/readers/web/spider_web/base.py
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 | |
TrafilaturaWebReader #
Bases: BasePydanticReader
Trafilatura web page reader.
Reads pages from the web.
Requires the trafilatura package.
Source code in llama_index/readers/web/trafilatura_web/base.py
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 | |
class_name
classmethod
#
class_name() -> str
Get the name identifier of the class.
Source code in llama_index/readers/web/trafilatura_web/base.py
19 20 21 22 | |
load_data #
load_data(urls: List[str], include_comments=True, output_format='txt', include_tables=True, include_images=False, include_formatting=False, include_links=False, show_progress=False, no_ssl=False, **kwargs) -> List[Document]
Load data from the urls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urls
|
List[str]
|
List of URLs to scrape. |
required |
include_comments
|
bool
|
Include comments in the output. Defaults to True. |
True
|
output_format
|
str
|
Output format. Defaults to 'txt'. |
'txt'
|
include_tables
|
bool
|
Include tables in the output. Defaults to True. |
True
|
include_images
|
bool
|
Include images in the output. Defaults to False. |
False
|
include_formatting
|
bool
|
Include formatting in the output. Defaults to False. |
False
|
include_links
|
bool
|
Include links in the output. Defaults to False. |
False
|
show_progress
|
bool
|
Show progress bar. Defaults to False |
False
|
no_ssl
|
bool
|
Bypass SSL verification. Defaults to False. |
False
|
kwargs
|
Additional keyword arguments for the |
{}
|
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: List of documents. |
Source code in llama_index/readers/web/trafilatura_web/base.py
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 | |
UnstructuredURLLoader #
Bases: BaseReader
Loader that uses unstructured to load HTML files.
Source code in llama_index/readers/web/unstructured_web/base.py
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 | |
load_data #
load_data() -> List[Document]
Load file.
Source code in llama_index/readers/web/unstructured_web/base.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
WholeSiteReader #
Bases: BaseReader
BFS Web Scraper for websites.
This class provides functionality to scrape entire websites using a breadth-first search algorithm. It navigates web pages from a given base URL, following links that match a specified prefix.
Attributes:
| Name | Type | Description |
|---|---|---|
prefix |
str
|
URL prefix to focus the scraping. |
max_depth |
int
|
Maximum depth for BFS algorithm. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix
|
str
|
URL prefix for scraping. |
required |
max_depth
|
int
|
Maximum depth for BFS. Defaults to 10. |
10
|
uri_as_id
|
bool
|
Whether to use the URI as the document ID. Defaults to False. |
False
|
Source code in llama_index/readers/web/whole_site/base.py
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 | |
setup_driver #
setup_driver()
Sets up the Selenium WebDriver for Chrome.
Returns:
| Name | Type | Description |
|---|---|---|
WebDriver |
An instance of Chrome WebDriver. |
Source code in llama_index/readers/web/whole_site/base.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
load_data #
load_data(base_url: str) -> List[Document]
Load data from the base URL using BFS algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_url
|
str
|
Base URL to start scraping. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: List of scraped documents. |
Source code in llama_index/readers/web/whole_site/base.py
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 | |
ZyteWebReader #
Bases: BasePydanticReader
Load text from URLs using Zyte api.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str
|
Zyte API key. |
required |
mode
|
Literal['article', 'html', 'html-text']
|
Determines how the text is extracted for the page content. It can take one of the following values: 'html', 'html-text', 'article' |
'article'
|
n_conn
|
int
|
It is the maximum number of concurrent requests to use. |
15
|
**download_kwargs
|
Optional[Dict[str, Any]]
|
Any additional download arguments to pass for download. See: https://docs.zyte.com/zyte-api/usage/reference.html |
None
|
Example
.. code-block:: python
from llama_index.readers.web import ZyteWebReader
reader = ZyteWebReader(
api_key="ZYTE_API_KEY",
)
docs = reader.load_data(
urls=["<url-1>", "<url-2>"],
)
Zyte-API reference
https://www.zyte.com/zyte-api/
Source code in llama_index/readers/web/zyte_web/base.py
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 | |
ZenRowsWebReader #
Bases: BasePydanticReader
ZenRows Web Reader.
Read web pages using ZenRows Universal Scraper API with advanced features like: - JavaScript rendering for dynamic content - Anti-bot bypass - Premium residential proxies with geo-location - Custom headers and session management - Advanced data extraction with CSS selectors - Multiple output formats (HTML, Markdown, Text, PDF) - Screenshot capabilities
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str
|
ZenRows API key. Get one at https://app.zenrows.com/register |
required |
js_render
|
Optional[bool]
|
Enable JavaScript rendering with a headless browser. Default False. |
required |
js_instructions
|
Optional[str]
|
Execute custom JavaScript on the page to interact with elements. |
required |
premium_proxy
|
Optional[bool]
|
Use residential IPs to bypass anti-bot protection. Default False. |
required |
proxy_country
|
Optional[str]
|
Set the country of the IP used for the request (requires Premium Proxies). |
required |
session_id
|
Optional[int]
|
Maintain the same IP for multiple requests for up to 10 minutes. |
required |
custom_headers
|
Optional[Dict[str, str]]
|
Include custom headers in your request to mimic browser behavior. |
required |
wait_for
|
Optional[str]
|
Wait for a specific CSS Selector to appear in the DOM before returning content. |
required |
wait
|
Optional[int]
|
Wait a fixed amount of milliseconds after page load. |
required |
block_resources
|
Optional[str]
|
Block specific resources (images, fonts, etc.) from loading. |
required |
response_type
|
Optional[Literal['markdown', 'plaintext', 'pdf']]
|
Convert HTML to other formats. |
required |
css_extractor
|
Optional[str]
|
Extract specific elements using CSS selectors (JSON format). |
required |
autoparse
|
Optional[bool]
|
Automatically extract structured data from HTML. Default False. |
required |
screenshot
|
Optional[str]
|
Capture an above-the-fold screenshot of the page. |
required |
screenshot_fullpage
|
Optional[str]
|
Capture a full-page screenshot. |
required |
screenshot_selector
|
Optional[str]
|
Capture a screenshot of a specific element using CSS Selector. |
required |
original_status
|
Optional[bool]
|
Return the original HTTP status code from the target page. Default False. |
required |
allowed_status_codes
|
Optional[str]
|
Returns content even if target page fails with specified status codes. |
required |
json_response
|
Optional[bool]
|
Capture network requests in JSON format. Default False. |
required |
screenshot_format
|
Optional[Literal['png', 'jpeg']]
|
Choose between png and jpeg formats for screenshots. |
required |
screenshot_quality
|
Optional[int]
|
For JPEG format, set quality from 1 to 100. |
required |
outputs
|
Optional[str]
|
Specify which data types to extract from the scraped HTML. |
required |
Source code in llama_index/readers/web/zenrows_web/base.py
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 | |
validate_css_extractor
classmethod
#
validate_css_extractor(v)
Validate that css_extractor is valid JSON if provided.
Source code in llama_index/readers/web/zenrows_web/base.py
137 138 139 140 141 142 143 144 145 146 | |
validate_proxy_country
classmethod
#
validate_proxy_country(v)
Validate that proxy_country is a two-letter country code.
Source code in llama_index/readers/web/zenrows_web/base.py
148 149 150 151 152 153 154 | |
class_name
classmethod
#
class_name() -> str
Get the name identifier of the class.
Source code in llama_index/readers/web/zenrows_web/base.py
164 165 166 167 | |
load_data #
load_data(urls: Union[str, List[str]], extra_params: Optional[Dict] = None, **kwargs) -> List[Document]
Load data from URLs using ZenRows API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urls
|
Union[str, List[str]]
|
Single URL string or list of URLs to scrape |
required |
extra_params
|
Optional[Dict]
|
Additional parameters for this specific request |
None
|
**kwargs
|
Additional keyword arguments (for compatibility) |
{}
|
Returns:
| Type | Description |
|---|---|
List[Document]
|
List of Document objects containing scraped content and metadata |
Source code in llama_index/readers/web/zenrows_web/base.py
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 | |
options: members: - AgentQLWebReader - AsyncWebPageReader - BeautifulSoupWebReader - BrowserbaseWebReader - FireCrawlWebReader - HyperbrowserWebReader - KnowledgeBaseWebReader - MainContentExtractorReader - NewsArticleReader - OlostepWebReader - OxylabsWebReader - ReadabilityWebPageReader - RssNewsReader - RssReader - ScrapflyReader - SimpleWebPageReader - SitemapReader - SpiderReader - TrafilaturaWebReader - UnstructuredURLLoader - WholeSiteReader - ZenRowsWebReader