philippta / flyscrape

Flyscrape is a command-line web scraping tool designed for those without advanced programming skills.
https://flyscrape.com
Mozilla Public License 2.0
1.04k stars 31 forks source link

Allow url be passed as argument #13

Closed carlosqsilva closed 11 months ago

carlosqsilva commented 11 months ago

It would be nice to pass the url as argument to overwrite config.url

example:

wrote this script, but now i want use for a different url in the same domain

export const config = {
  url: "https://example.com/HXXluMZo",
};
export default function({ doc, absoluteURL }) {
  return links = doc.find("a.box-link").map(link => absoluteURL(link.attr("href")))
}
$ fly run example.js --url example.com/ywwU2do6
philippta commented 11 months ago

This is a good idea I also had in my head. Ideally it should be possible to use cli flags to override or set any configuration option.

philippta commented 11 months ago

@carlosqsilva Support for CLI arguments has been added. You can now set or override any config option via a CLI flag, e.g:

flyscrape run example.js --url "http://other.com"

flyscrape run example.js --proxies "http://someproxy:8043"

flyscrape run example.js --depth 5 --follow ".next-button > a"