{"action":"created","issue":{"url":"https://api.github.com/repos/scrapy/scrapy/issues/1052","labels_url":"https://api.github.com/repos/scrapy/scrapy/issues/1052/labels{/name}","comments_url":"https://api.github.com/repos/scrapy/scrapy/issues/1052/comments","events_url":"https://api.github.com/repos/scrapy/scrapy/issues/1052/events","html_url":"https://github.com/scrapy/scrapy/issues/1052","id":58534308,"number":1052,"title":"standalone Selector()","user":{"login":"nyov","id":438293,"avatar_url":"https://avatars.githubusercontent.com/u/438293?v=3","gravatar_id":"","url":"https://api.github.com/users/nyov","html_url":"https://github.com/nyov","followers_url":"https://api.github.com/users/nyov/followers","following_url":"https://api.github.com/users/nyov/following{/other_user}","gists_url":"https://api.github.com/users/nyov/gists{/gist_id}","starred_url":"https://api.github.com/users/nyov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyov/subscriptions","organizations_url":"https://api.github.com/users/nyov/orgs","repos_url":"https://api.github.com/users/nyov/repos","events_url":"https://api.github.com/users/nyov/events{/privacy}","received_events_url":"https://api.github.com/users/nyov/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-23T01:54:41Z","updated_at":"2015-02-27T15:54:00Z","closed_at":"2015-02-27T15:54:00Z","body":"I'd love to be able to use scrapy's `Selector` outside of scrapy, as an xpath (and css?) selector library for xml, html, sgml documents.\r\nI suppose I should go looking at BeautifulSoup for that, but I'm familiar with `Selector` and like the way it works. I don't like plain lxml's way of doing things and usually don't need any write-abilities on the tree anyway.\r\n\r\nWould it be feasible and sensible to make the selector parts of scrapy not depend on `SomeResponse` and expect response.url objects (but `SomeDocument` instead) and put it together with things such as `LxmlDocument`, then have some glue-code to bind it to object_ref and response objects and such in scrapy?\r\n\r\nAt least in my mind this makes sense with the \"librarization\" goal of scrapy in mind, but maybe I'm wrong or that'd be too much of a design change when there is BeautifulSoup.\r\n\r\n\r\np.s. before anyone comments that it is possible: I know I _can_ use it outside scrapy, with something like this (but thats still having all of scrapy inside another project or rewriting a lot to factor out the selector stuff):\r\n```python\r\nnamespaces = [\r\n\t('x',    'http://www.w3.org/1999/xhtml'),\r\n]\r\nwith open('file') as f:\r\n\tdata = f.read()\r\nxs = Selector(text=data, type='xml')\r\nfor namespace, scheme in namespaces:\r\n\txs.register_namespace(namespace, scheme)\r\nprint(xs.xpath('/x:html').extract())\r\n```"},"comment":{"url":"https://api.github.com/repos/scrapy/scrapy/issues/comments/76416635","html_url":"https://github.com/scrapy/scrapy/issues/1052#issuecomment-76416635","issue_url":"https://api.github.com/repos/scrapy/scrapy/issues/1052","id":76416635,"user":{"login":"nyov","id":438293,"avatar_url":"https://avatars.githubusercontent.com/u/438293?v=3","gravatar_id":"","url":"https://api.github.com/users/nyov","html_url":"https://github.com/nyov","followers_url":"https://api.github.com/users/nyov/followers","following_url":"https://api.github.com/users/nyov/following{/other_user}","gists_url":"https://api.github.com/users/nyov/gists{/gist_id}","starred_url":"https://api.github.com/users/nyov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyov/subscriptions","organizations_url":"https://api.github.com/users/nyov/orgs","repos_url":"https://api.github.com/users/nyov/repos","events_url":"https://api.github.com/users/nyov/events{/privacy}","received_events_url":"https://api.github.com/users/nyov/received_events","type":"User","site_admin":false},"created_at":"2015-02-27T15:53:59Z","updated_at":"2015-02-27T15:53:59Z","body":"Oh awesome.\r\nThanks for the link and work done.\r\nClosing this as duplicate."}}