{"id":20439858,"url":"https://github.com/v-braun/hero-scrape","last_synced_at":"2025-03-05T07:32:52.459Z","repository":{"id":57559427,"uuid":"159981646","full_name":"v-braun/hero-scrape","owner":"v-braun","description":"Find the hero (main) image of an URL ","archived":false,"fork":false,"pushed_at":"2018-12-24T22:53:10.000Z","size":82,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-15T20:20:54.635Z","etag":null,"topics":["crawler","fastimage","hero","hero-image","opengraph","webscraping"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/v-braun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-01T19:52:59.000Z","updated_at":"2023-08-03T19:31:15.000Z","dependencies_parsed_at":"2022-08-28T14:02:56.949Z","dependency_job_id":null,"html_url":"https://github.com/v-braun/hero-scrape","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v-braun%2Fhero-scrape","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v-braun%2Fhero-scrape/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v-braun%2Fhero-scrape/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v-braun%2Fhero-scrape/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/v-braun","download_url":"https://codeload.github.com/v-braun/hero-scrape/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241989319,"owners_count":20053796,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crawler","fastimage","hero","hero-image","opengraph","webscraping"],"created_at":"2024-11-15T09:19:58.892Z","updated_at":"2025-03-05T07:32:52.429Z","avatar_url":"https://github.com/v-braun.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hero-scrape\n\u003e Find the hero (main) image of an URL \n\n[![Build Status](https://travis-ci.org/v-braun/hero-scrape.svg?branch=master)](https://travis-ci.org/v-braun/hero-scrape)\n[![codecov](https://codecov.io/gh/v-braun/hero-scrape/branch/master/graph/badge.svg)](https://codecov.io/gh/v-braun/hero-scrape)\n\nBy [v-braun - viktor-braun.de](https://viktor-braun.de).\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"70%\" src=\"https://raw.githubusercontent.com/v-braun/hero-scrape/master/logo.png?sanitize=true\" /\u003e\n\u003c/p\u003e\n\n## Demo\nSee a demo on https://hero-scrape.viktor-braun.de\n\n## Description\nhero-scrape extracts the main image of a webpage.\nIt use different strategies to find the main images (OpenGraph HTML Tags and heuristic search).\nYou can use the existing strategies or implement your own.\n\nTo find the \"biggest\" image it is necessary to download it. [fastimage](https://github.com/rubenfonseca/fastimage/) is the perfect choice for that job.\n\n\n\n\n## Installation\n\n```bash\ngo get github.com/v-braun/hero-scrape\n```\n\n## Usage\n\n**With pre configured strategies**\n\n```go\npageUrl, _ := url.Parse(\"https://github.com/v-braun/hero-scrape\")\nres, _ := http.Get(pageUrl.String())\ndefer res.Body.Close()\n\nresult, _ := heroscrape.Scrape(pageUrl, res.Body)\nfmt.Println(result.Image)\n\n```\n\n**With cusom strategies**\n\n```go\npageUrl, _ := url.Parse(\"https://github.com/v-braun/hero-scrape\")\nres, _ := http.Get(pageUrl.String())\ndefer res.Body.Close()\n\nresult, _ := heroscrape.ScrapeWithStrategy(pageUrl, res.Body, , NewOgStrategy(), NewHeuristicStrategy(), YourOwnStrategy())\nfmt.Println(result.Image)\n\n```\n\n\n## Related Projects\n- [hero-scrape](https://github.com/v-braun/hero-scrape-web) Demo for this lib\n- [fastimage](https://github.com/rubenfonseca/fastimage/) Finds the type and/or size of a remote image given its uri, by fetching as little as needed.\n- [goquery](https://github.com/PuerkitoBio/goquery) A little like that j-thing, only in Go.\n\n## Known Issues\n\nIf you discover any bugs, feel free to create an issue on GitHub fork and\nsend me a pull request.\n\n[Issues List](https://github.com/v-braun/hero-scrape/issues).\n\n## Authors\n\n![image](https://avatars3.githubusercontent.com/u/4738210?v=3\u0026s=50)  \n[v-braun](https://github.com/v-braun/)\n\n\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n\n## License\n\nSee [LICENSE](https://github.com/v-braun/hero-scrape/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv-braun%2Fhero-scrape","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fv-braun%2Fhero-scrape","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv-braun%2Fhero-scrape/lists"}