Added README
This commit is contained in:
parent
2afe840ede
commit
46c174be8d
@ -28,6 +28,6 @@ char *extract_h1(const char *html, size_t len);
|
|||||||
* Returns 0 and allocates *out on success (caller frees), or -1.
|
* Returns 0 and allocates *out on success (caller frees), or -1.
|
||||||
* Each line represents one product; fields are separated by '|'.
|
* Each line represents one product; fields are separated by '|'.
|
||||||
*/
|
*/
|
||||||
int extract_products(const char *html, size_t len, char **out);
|
int extract_products(const char *html, size_t len, const char *base_url, char **out);
|
||||||
|
|
||||||
#endif /* SCRAPER_H */
|
#endif /* SCRAPER_H */
|
||||||
|
|||||||
@ -390,7 +390,7 @@ static char *find_price_in_node(xmlNode *node) {
|
|||||||
if (xmlStrcasecmp(cur->name, (const xmlChar *)"a") != 0 &&
|
if (xmlStrcasecmp(cur->name, (const xmlChar *)"a") != 0 &&
|
||||||
xmlStrcasecmp(cur->name, (const xmlChar *)"h1") != 0 &&
|
xmlStrcasecmp(cur->name, (const xmlChar *)"h1") != 0 &&
|
||||||
xmlStrcasecmp(cur->name, (const xmlChar *)"h2") != 0 &&
|
xmlStrcasecmp(cur->name, (const xmlChar *)"h2") != 0 &&
|
||||||
(strchr(txt, '$') || strchr(txt, '£') || strchr(txt, '€') || strstr(txt, "USD") || strstr(txt, "EUR"))) {
|
(strchr(txt, '$') || strstr(txt, "£") || strstr(txt, "€") || strstr(txt, "USD") || strstr(txt, "EUR"))) {
|
||||||
if (strlen(txt) < 200) {
|
if (strlen(txt) < 200) {
|
||||||
char *trim = strdup(txt);
|
char *trim = strdup(txt);
|
||||||
free(txt);
|
free(txt);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user