Question: I'm trying to to fetch a page that has many urls and other stuff all in just one line in a plain text like

```
"link_url":"http://www.example.com/link1?site=web","mobile_link_url":"http://m.example.com/episode/link1?site=web" link_url":"http://www.example.com/link2?site=web","mobile_link_url":"http://m.example.com/episode/link2?site=web"

```

i tired 

```
import re
import requests as req

response = req.get("http://api.example.com/?callback=jQuery112")

content = response.text

```

print content will give me the "link\_url": output 
but i need to find 

```
http://www.example.com/link1?site=web
http://www.example.com/link2?site=web

```

and output only link1 and link2 to a file like 

```
link1
link2
link3

```

Answer: 
The code below might be what you need.

```
import re

urls = '''"link_url":"http://www.example.com/link1?site=web","mobile_link_url":"http://m.example.com/episode/link1?site=web" link_url":"http://www.example.com/link2?site=web","mobile_link_url":"http://m.example.com/episode/link2?site=web"'''

links = re.findall(r'http://www[a-z/.?=:]+(link\d)+', urls)
print(links)

```
If it is a string and not a JSON object, then you could do this even though it's a bit hacky:

```
s1 ="\"link_url\":\"http://www.example.com/link1?site=web\",\"mobile_link_url\":\"http://m.example.com/episode/link1?site=web\" link_url\":\"http://www.example.com/link2?site=web\",\"mobile_link_url\":\"http://m.example.com/episode/link2?site=web\""

links = [x for x in s1.replace("\":\"", "LINK_DELIM").replace("\"", "").replace(" ", ",").split(",")]

for link in links:
    print(link.split("LINK_DELIM")[1])

```

Which yields:

```
http://www.example.com/link1?site=web
http://m.example.com/episode/link1?site=web
http://www.example.com/link2?site=web
http://m.example.com/episode/link2?site=web

```

Though I think `@al76`'s answer is more elegant for this.

But if it's a JSON which looks like:

```
[
  {
    "link_url": "http://www.example.com/link1?site=web",
    "mobile_link_url": "http://m.example.com/episode/link1?site=web"
  },
  {
    "link_url": "http://www.example.com/link2?site=web",
    "mobile_link_url": "http://m.example.com/episode/link2?site=web"
  }
]

```

Then you could do something like:

```
import json
s1 = "[{ \"link_url \": \"http://www.example.com/link1?site=web \", \"mobile_link_url \": \"http://m.example.com/episode/link1?site=web \"}, { \"link_url \": \"http://www.example.com/link2?site=web \", \"mobile_link_url \": \"http://m.example.com/episode/link2?site=web \"} ]"
data = json.loads(s1)
links = [y for x in data for y in x.values()]

for link in links:
    print(link)

```