Figuring out which Airline a flight is operated for?

I am trying to figure out who the real airline from the users perspective is for a flight by Colgan Air: CJC 4833. Originally I though that all CJC flights could be displayed to the user as United, but it turns out that CJC4833 is opperated for US Airways.

Is there any way I can do something like query for both UA4833 and US4833 and figure it out? Is there any better approach do doing this?

The “questions/answers” (available at the top right of every page) should help you. Here’s what it says on code share flights:

FlightAware does not generally currently support mainline code share, such as a Continental flight being operated by Delta. However, FlightAware supports “express” code shares where passengers are less likely to be aware of the situation such as Continental 1251 being operated by “Continental Express”, which is actually ExpressJet Airlines. FlightAware will either make the correction (e.g., COA1251->BTA1251) automatically or offer a list of possible matches if there is any ambiguity. When presented with a list of suggestions, you can select the correct flight by looking for the origin and destination that you are expecting.

Regional Carrier codeshares are often not automatically corrected.

Try NWA2936.
the flight is actually FLG2936, but the real flight is at the bottom of the page.

However, no, there is no way to know which brand the aircraft is flying under, however often times it can be deduced by the route if one is relatively familiar with major carrier’s routes and hubs.

Mainline:Regional flight numbers are not a one to one mapping. We do the best we can to keep up to date, but they change frequently.

It would be nice that if you could maintain a list of which regional carriers operate for which mainline carriers.
For Example, for NWA, we have MES, FLG, and CPZ.
For the flight previously mentioned, if NWA2936 was inputted, it would be nice for the system to recognize NWA and only display flights from known NWA regional carriers instead of a whole slew of flights that could never be the one a user is looking for.

The problem with this is that many regionals operate for two or more carriers. Examples:
Skywest operates for Northwest, Delta, and Midwest.
Expressjet operates for Delta and Continental in addition to their own branded flights.
Mesa operates for Delta, US Airways, and United and also under the gojet name

Also, what about the major airlines that code share on another major airline? Example:

Okay, I found that using the API, I iterate over each of the major airline codes, and request the flight using that airline code. The first one that makes an actual hit is marked as the parent carrier. It’s not perfect, but it works in 85% of the cases. The other 15% I am manually managing, but I am adding another datasource to fill them in.