mjrode

mjrode

Need help with web scraping and parsing data in Elixir

I have been trying to build a side project for about 6 months now and am extremely frustrated and not sure where to turn for help.

I originally wrote the application in Rails and had what I thought was a decent working version but the code became a mess and I just couldn’t rely on the data I was getting back from my web scraping.

You can see an example of my scraping code here.

I decided that I would try to rebuild this application in Elixir because I wanted to build something that was more reliable and I wanted to learn more about Elixir.

Well now I have spent a few weeks building it out and have run into the same issues (even worse now) that I was having with my Rails app. (FYI I am new to programming)

I am trying to scrape two tables in particular this one and this one.

You can see examples of my scrape logic here and here.

Now the issue I am having is there are small inconsistencies in the tables and where they are placed within the DOM that I do not know how to account for. I tried to write tests for these modules but there is only so much I can test. Also I am grabbing a lot of this data by filtering through parent classes to grab it so if any of the parent classes are off it ruins everything.

After reviewing the results of my scrapped data I realized that much of the information I was collection was either wrong or null.

I am at my wits end and don’t want to give up on this project but there is no point for me to continue to build this out if I can’t figure out a reliable way to scrape this data.

I am sorry for the long rambling post but was just curious if anyone would be able to help me out, I would honestly pay for your time at this point just so I could learn the proper way to go about doing something like this.

Most Liked

BrightEyesDavid

BrightEyesDavid

Hi there. I’m also relatively new and I haven’t looked at your code yet as I’m on the phone, but if the HTML is valid(ish?) XML perhaps using an XML library such as SweetXML could be a good approach. You could then use XPath to select the elements required, which is very flexible and can help avoid relying on brittle structure.

mjrode

mjrode

Thanks David I will check that out!

dimitarvp

dimitarvp

Did somebody help you? Or did you do it yourself?

Where Next?

Popular in Questions Top

lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call t...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New

Other popular topics Top

Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

We're in Beta

About us Mission Statement